Skip to content

Commit f58fd39

Browse files
committed
export Logging, removing using Logging from examples
1 parent 794890a commit f58fd39

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ see the HTTP example below.
153153
Another example is using them to stop messages every being repeated within a given time period.
154154
155155
```julia
156-
using Dates, Logging, LoggingExtras
156+
using Dates, LoggingExtras
157157

158158
julia> function make_throttled_logger(period)
159159
history = Dict{Symbol, DateTime}()
@@ -195,7 +195,7 @@ that just checks if the level of the message is above the level specified when i
195195
### Demo: filter out all the log messages that are less severe than `Error`
196196
197197
```julia
198-
julia> using Logging, LoggingExtras
198+
julia> using LoggingExtras
199199

200200
julia> error_only_logger = MinLevelLogger(current_logger(), Logging.Error);
201201

@@ -221,7 +221,7 @@ and should return a new modified named tuple.
221221
A simple example of its use is truncating messages.
222222
223223
```julia
224-
julia> using Logging, LoggingExtras
224+
julia> using LoggingExtras
225225

226226
julia> truncating_logger = TransformerLogger(global_logger()) do log
227227
if length(log.message) > 128
@@ -262,7 +262,7 @@ We are going to log info and above to one file,
262262
and warnings and above to another.
263263
264264
```julia
265-
julia> using Logging; using LoggingExtras;
265+
julia> using LoggingExtras;
266266

267267
julia> demux_logger = TeeLogger(
268268
MinLevelLogger(FileLogger("info.log"), Logging.Info),
@@ -298,7 +298,7 @@ when the `DateFormat` would change the filename. Note that if you wish to have
298298
escape them so they are not interpreted by the `DateFormat` code. Example:
299299
300300
```julia
301-
julia> using Logging, LoggingExtras
301+
julia> using LoggingExtras
302302

303303
julia> rotating_logger = DatetimeRotatingFileLogger(pwd(), raw"\a\c\c\e\s\s-YYYY-mm-dd-HH-MM-SS.\l\o\g");
304304

@@ -326,7 +326,7 @@ The `FormatLogger` is a sink that formats the message and prints to a wrapped IO
326326
Formatting is done by providing a function `f(io::IO, log_args::NamedTuple)`.
327327
328328
```julia
329-
julia> using Logging, LoggingExtras
329+
julia> using LoggingExtras
330330

331331
julia> logger = FormatLogger() do io, args
332332
println(io, args._module, " | ", "[", args.level, "] ", args.message)
@@ -346,7 +346,6 @@ Main | [Warn] This is a warning, should take a look.
346346
347347
```julia
348348
using LoggingExtras
349-
using Logging
350349

351350
function sensible_message_filter(log)
352351
length(log.message) < 1028
@@ -360,7 +359,6 @@ global_logger(ActiveFilteredLogger(sensible_message_filter, global_logger()))
360359
361360
```julia
362361
using LoggingExtras
363-
using Logging
364362
using HTTP
365363

366364
function not_HTTP_message_filter(log)
@@ -374,7 +372,6 @@ global_logger(EarlyFilteredLogger(not_HTTP_message_filter, global_logger()))
374372
375373
```julia
376374
using LoggingExtras
377-
using Logging
378375
using HTTP
379376

380377
transformer_logger(global_logger()) do log
@@ -393,7 +390,7 @@ global_logger(transformer_logger)
393390
## Add timestamp to all logging
394391
395392
```julia
396-
using Logging, LoggingExtras, Dates
393+
using LoggingExtras, Dates
397394

398395
const date_format = "yyyy-mm-dd HH:MM:SS"
399396

src/LoggingExtras.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export TeeLogger, TransformerLogger, FileLogger,
1818
# https://github.com/JuliaLang/julia/blob/release-1.6/stdlib/Logging/src/Logging.jl#L32-L46
1919
using Logging
2020

21-
export AbstractLogger, LogLevel, NullLogger,
21+
export Logging, AbstractLogger, LogLevel, NullLogger,
2222
@debug, @info, @warn, @error, @logmsg,
2323
with_logger, current_logger, global_logger, disable_logging,
2424
SimpleLogger, ConsoleLogger

0 commit comments

Comments
 (0)