@@ -50,8 +50,7 @@ ConsoleLogger(stream, min_level) =
5050
5151# Usage
5252Load the package with ` using LoggingExtras ` .
53- You likely also want to load the ` Logging ` standard lib.
54- Loggers can be constructed and used like normal.
53+ For convenience, this also re-exports the ` Logging ` standard library.
5554
5655
5756### Basics of working with loggers
@@ -154,7 +153,7 @@ see the HTTP example below.
154153Another example is using them to stop messages every being repeated within a given time period.
155154
156155``` julia
157- using Dates, Logging, LoggingExtras
156+ using Dates, LoggingExtras
158157
159158julia> function make_throttled_logger (period)
160159 history = Dict {Symbol, DateTime} ()
@@ -196,7 +195,7 @@ that just checks if the level of the message is above the level specified when i
196195### Demo: filter out all the log messages that are less severe than `Error`
197196
198197``` julia
199- julia> using Logging, LoggingExtras
198+ julia> using LoggingExtras
200199
201200julia> error_only_logger = MinLevelLogger (current_logger (), Logging. Error);
202201
@@ -222,7 +221,7 @@ and should return a new modified named tuple.
222221A simple example of its use is truncating messages.
223222
224223``` julia
225- julia> using Logging, LoggingExtras
224+ julia> using LoggingExtras
226225
227226julia> truncating_logger = TransformerLogger (global_logger ()) do log
228227 if length (log. message) > 128
@@ -263,7 +262,7 @@ We are going to log info and above to one file,
263262and warnings and above to another.
264263
265264``` julia
266- julia> using Logging; using LoggingExtras;
265+ julia> using LoggingExtras;
267266
268267julia> demux_logger = TeeLogger (
269268 MinLevelLogger (FileLogger (" info.log" ), Logging. Info),
@@ -299,7 +298,7 @@ when the `DateFormat` would change the filename. Note that if you wish to have
299298escape them so they are not interpreted by the `DateFormat` code. Example:
300299
301300``` julia
302- julia> using Logging, LoggingExtras
301+ julia> using LoggingExtras
303302
304303julia> rotating_logger = DatetimeRotatingFileLogger (pwd (), raw " \a\c\c\e\s\s -YYYY-mm-dd-HH-MM-SS.\l\o\g " );
305304
@@ -327,7 +326,7 @@ The `FormatLogger` is a sink that formats the message and prints to a wrapped IO
327326Formatting is done by providing a function `f(io::IO, log_args::NamedTuple)`.
328327
329328``` julia
330- julia> using Logging, LoggingExtras
329+ julia> using LoggingExtras
331330
332331julia> logger = FormatLogger () do io, args
333332 println (io, args. _module, " | " , " [" , args. level, " ] " , args. message)
@@ -347,7 +346,6 @@ Main | [Warn] This is a warning, should take a look.
347346
348347``` julia
349348using LoggingExtras
350- using Logging
351349
352350function sensible_message_filter (log)
353351 length (log. message) < 1028
@@ -361,7 +359,6 @@ global_logger(ActiveFilteredLogger(sensible_message_filter, global_logger()))
361359
362360``` julia
363361using LoggingExtras
364- using Logging
365362using HTTP
366363
367364function not_HTTP_message_filter (log)
@@ -375,7 +372,6 @@ global_logger(EarlyFilteredLogger(not_HTTP_message_filter, global_logger()))
375372
376373``` julia
377374using LoggingExtras
378- using Logging
379375using HTTP
380376
381377transformer_logger (global_logger ()) do log
@@ -394,7 +390,7 @@ global_logger(transformer_logger)
394390## Add timestamp to all logging
395391
396392``` julia
397- using Logging, LoggingExtras, Dates
393+ using LoggingExtras, Dates
398394
399395const date_format = " yyyy-mm-dd HH:MM:SS"
400396
0 commit comments