@@ -153,7 +153,7 @@ see the HTTP example below.
153
153
Another example is using them to stop messages every being repeated within a given time period.
154
154
155
155
``` julia
156
- using Dates, Logging, LoggingExtras
156
+ using Dates, LoggingExtras
157
157
158
158
julia> function make_throttled_logger (period)
159
159
history = Dict {Symbol, DateTime} ()
@@ -195,7 +195,7 @@ that just checks if the level of the message is above the level specified when i
195
195
### Demo: filter out all the log messages that are less severe than `Error`
196
196
197
197
``` julia
198
- julia> using Logging, LoggingExtras
198
+ julia> using LoggingExtras
199
199
200
200
julia> error_only_logger = MinLevelLogger (current_logger (), Logging. Error);
201
201
@@ -221,7 +221,7 @@ and should return a new modified named tuple.
221
221
A simple example of its use is truncating messages.
222
222
223
223
``` julia
224
- julia> using Logging, LoggingExtras
224
+ julia> using LoggingExtras
225
225
226
226
julia> truncating_logger = TransformerLogger (global_logger ()) do log
227
227
if length (log. message) > 128
@@ -262,7 +262,7 @@ We are going to log info and above to one file,
262
262
and warnings and above to another.
263
263
264
264
``` julia
265
- julia> using Logging; using LoggingExtras;
265
+ julia> using LoggingExtras;
266
266
267
267
julia> demux_logger = TeeLogger (
268
268
MinLevelLogger (FileLogger (" info.log" ), Logging. Info),
@@ -298,7 +298,7 @@ when the `DateFormat` would change the filename. Note that if you wish to have
298
298
escape them so they are not interpreted by the `DateFormat` code. Example:
299
299
300
300
``` julia
301
- julia> using Logging, LoggingExtras
301
+ julia> using LoggingExtras
302
302
303
303
julia> rotating_logger = DatetimeRotatingFileLogger (pwd (), raw " \a\c\c\e\s\s -YYYY-mm-dd-HH-MM-SS.\l\o\g " );
304
304
@@ -326,7 +326,7 @@ The `FormatLogger` is a sink that formats the message and prints to a wrapped IO
326
326
Formatting is done by providing a function `f(io::IO, log_args::NamedTuple)`.
327
327
328
328
``` julia
329
- julia> using Logging, LoggingExtras
329
+ julia> using LoggingExtras
330
330
331
331
julia> logger = FormatLogger () do io, args
332
332
println (io, args. _module, " | " , " [" , args. level, " ] " , args. message)
@@ -346,7 +346,6 @@ Main | [Warn] This is a warning, should take a look.
346
346
347
347
``` julia
348
348
using LoggingExtras
349
- using Logging
350
349
351
350
function sensible_message_filter (log)
352
351
length (log. message) < 1028
@@ -360,7 +359,6 @@ global_logger(ActiveFilteredLogger(sensible_message_filter, global_logger()))
360
359
361
360
``` julia
362
361
using LoggingExtras
363
- using Logging
364
362
using HTTP
365
363
366
364
function not_HTTP_message_filter (log)
@@ -374,7 +372,6 @@ global_logger(EarlyFilteredLogger(not_HTTP_message_filter, global_logger()))
374
372
375
373
``` julia
376
374
using LoggingExtras
377
- using Logging
378
375
using HTTP
379
376
380
377
transformer_logger (global_logger ()) do log
@@ -393,7 +390,7 @@ global_logger(transformer_logger)
393
390
## Add timestamp to all logging
394
391
395
392
``` julia
396
- using Logging, LoggingExtras, Dates
393
+ using LoggingExtras, Dates
397
394
398
395
const date_format = " yyyy-mm-dd HH:MM:SS"
399
396
0 commit comments