From 0cdfa63b9ce75e5db1e05d2332d6cab667a9f7e1 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Fri, 15 Nov 2024 17:58:47 +0200 Subject: Implement interpolation --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index b19e38b..dcefc94 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,19 @@ Loggr is very simple to use, and looks like this: ```php $loggr = new Loggr(new FileSystemDriver('path-to-logs')); -$loggr->info('context'); +$loggr->info('message', ['some-data' => 'goes-here']); ``` All you have to do is instantiate Loggr with the appropriate driver for your use case and then simply -log away with any data you want to give it. It takes scalar values, as well as arrays and objects. +log away with any data you want to give it. As per the PSR-3 standard, you can also interpolate context values +into the message placeholder, like so: + +```php +$loggr = new Loggr(new FileSystemDriver('path-to-logs')); +$loggr->info('Hello {who}', ['who' => 'World']); +``` + +Which would then output `Hello World` as the message. ### Methods -- cgit v1.2.3