Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
terwey authored Jan 27, 2017
1 parent 4ddac0c commit 16240d5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ $logger->critical('critical message', $context);

Check the [generated API docs](API.md) for more info.

# Muting Messages for Handlers
Sometimes you want to initialise multiple Handlers but not send a message to each. This can be done using the Mute option.

```php
// initialise a few Handlers, use the default verbosity set in the Handler
$shellHandler = new Handler\ShellHandler('trace');
// set the Verbosity to -1, which allows it to be muted
$arrayHandler = new Handler\ArrayHandler('debug', -1);

$logger = new Logger([$shellHandler, $arrayHandler]);

// now send a message where $muted is set to true
$logger->log('debug', 'foobar', ['baz'=>'bar'], true);
```

The result will be that ShellHandler will output the message "foobar", however the ArrayHandler will not receive the message.

This is useful if you always want to log messages to a centralised logging system but the production environment that the client can see doesn't need to see that message.

# Trace level
The Flexilog adds one more level lower then `debug`, the `trace` level. To keep it compatible with the `PSR\NullLogger` you need to call it in the following way:

Expand Down

0 comments on commit 16240d5

Please sign in to comment.