Skip to content

Commit 5114301

Browse files
authored
Add examples
1 parent 8445298 commit 5114301

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,35 @@ julia> with_logger(filtered_logger) do
130130
[ Info: Yo Dawg! it is all good
131131
```
132132

133+
134+
135+
# Examples
136+
137+
## Filter out any overly long messages
138+
139+
```
140+
using LoggingExtras
141+
using Logging
142+
143+
function sensible_message_filter(level, message, _module, group, id, file, line; kwargs...)
144+
length(message) < 1028
145+
end
146+
147+
global_logger(FilteredLogger(sensible_message_filter, global_logger()))
148+
```
149+
150+
151+
## Filterout any messages from HTTP
152+
153+
```
154+
using LoggingExtras
155+
using Logging
156+
using HTTP
157+
158+
function not_HTTP_message_filter(level, message, _module, group, id, file, line; kwargs...)
159+
_module != HTTP
160+
end
161+
162+
global_logger(FilteredLogger(not_HTTP_message_filter, global_logger()))
163+
```
164+

0 commit comments

Comments
 (0)