summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nth.ee>2024-11-15 17:58:47 +0200
committerAsko Nõmm <asko@nth.ee>2024-11-15 17:58:47 +0200
commit0cdfa63b9ce75e5db1e05d2332d6cab667a9f7e1 (patch)
tree314ab8b5d749650d9da362212b7f0e63db38ddba /README.md
parentbac7b24d9a1fe3d7b8dd68102794f786f7c43000 (diff)
Implement interpolation
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 10 insertions, 2 deletions
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