Skip to content

Commit af567a8

Browse files
authored
Merge pull request #28 from oxinabox/ox/minleveldemo
Add MinLevelLogger example to readme
2 parents a2994b7 + 2c882fe commit af567a8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,22 @@ end
230230
This is basically a special case of the early filtered logger,
231231
that just checks if the level of the message is above the level specified when it was created.
232232
233+
### Demo: filter out all the log messages that are less severe than `Error`
234+
235+
```julia
236+
julia> using Logging, LoggingExtras
237+
238+
julia> error_only_logger = MinLevelLogger(current_logger(), Logging.Error);
239+
240+
julia> with_logger(error_only_logger) do
241+
@info("You won't see this")
242+
@warn("won't see this either")
243+
@error("You will only see this")
244+
end
245+
┌ Error: You will only see this
246+
└ @ Main REPL[18]:4
247+
```
248+
233249
## `TransformerLogger`
234250
The transformer logger allows for the modification of log messages.
235251
This modification includes such things as its log level, and content,

0 commit comments

Comments
 (0)