@@ -37,7 +37,7 @@ and it has a min_enabled_level setting, that controls if it will accept a messag
37
37
(Early Filtering, in particular see ` MinLevelLogger ` ).
38
38
If it was to be defined in a compositional way,
39
39
we would write something along the lines of:
40
- ```
40
+ ``` julia
41
41
ConsoleLogger (stream, min_level) =
42
42
MinLevelLogger (
43
43
ActiveFilteredLogger (max_log_filter,
@@ -58,19 +58,19 @@ Loggers can be constructed and used like normal.
58
58
For full details, see the [ Julia documentation on Logging] ( https://docs.julialang.org/en/v1/stdlib/Logging/index.html )
59
59
60
60
To use a ` logger ` in a given scope do
61
- ```
61
+ ``` julia
62
62
with_logger (logger) do
63
63
# things
64
64
end
65
65
```
66
66
67
67
To make a logger the global logger, use
68
- ```
68
+ ``` julia
69
69
global_logger (logger)
70
70
```
71
71
72
72
to get the current global logger, use
73
- ```
73
+ ``` julia
74
74
logger = global_logger ()
75
75
```
76
76
@@ -115,7 +115,7 @@ The resulting file format is similar to that which is shown in the REPL.
115
115
We are going to log info and above to one file,
116
116
and warnings and above to another.
117
117
118
- ```
118
+ ``` julia
119
119
julia> using Logging; using LoggingExtras;
120
120
121
121
julia> demux_logger = DemuxLogger (
@@ -158,7 +158,7 @@ The filter function takes the full set of parameters of the message.
158
158
### Demo
159
159
We want to filter to only log strings staring with ` "Yo Dawg!" ` .
160
160
161
- ```
161
+ ``` julia
162
162
julia> function yodawg_filter (log_args)
163
163
startswith (log_args. message, " Yo Dawg!" )
164
164
end
@@ -191,7 +191,7 @@ see the HTTP example below.
191
191
192
192
Another example is using them to stop messages every being repeated within a given time period.
193
193
194
- ```
194
+ ``` julia
195
195
using Dates, Logging, LoggingExtras
196
196
197
197
julia> function make_throttled_logger (period)
@@ -243,7 +243,7 @@ and should return a new modified named tuple.
243
243
244
244
A simple example of its use is truncating messages.
245
245
246
- ```
246
+ ``` julia
247
247
julia> using Logging, LoggingExtras
248
248
249
249
julia> truncating_logger = TransformerLogger (global_logger ()) do log
@@ -273,7 +273,7 @@ for example to set them all to the same `group`.
273
273
274
274
## Filter out any overly long messages
275
275
276
- ```
276
+ ``` julia
277
277
using LoggingExtras
278
278
using Logging
279
279
@@ -287,7 +287,7 @@ global_logger(ActiveFilteredLogger(sensible_message_filter, global_logger()))
287
287
288
288
## Filterout any messages from HTTP
289
289
290
- ```
290
+ ``` julia
291
291
using LoggingExtras
292
292
using Logging
293
293
using HTTP
@@ -301,7 +301,7 @@ global_logger(EarlyFilteredLogger(not_HTTP_message_filter, global_logger()))
301
301
302
302
## Raising HTTP debug level errors to be Info level
303
303
304
- ```
304
+ ``` julia
305
305
using LoggingExtras
306
306
using Logging
307
307
using HTTP
0 commit comments