Skip to content

Commit

Permalink
Merge pull request #185 from invenia/rf/nothing-mod
Browse files Browse the repository at this point in the history
Reroute `nothing` stdlib `mod` to the root logger
  • Loading branch information
rofinn committed Apr 29, 2022
2 parents eccf67a + ecb6faa commit 916ea2e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Memento"
uuid = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9"
license = "MIT"
authors = ["Invenia Technical Computing"]
version = "1.3.0"
version = "1.3.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
4 changes: 4 additions & 0 deletions src/stdlib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ function substitute!(level::LogLevel=min_enabled_level(global_logger()))
global_logger(BaseLogger(level))
notice(getlogger(@__MODULE__), "Substituting global logging with Memento")
end

# `getlogger` dispatch to reroute stdlib messages with `mod=nothing` to the root logger,
# similar to calling `getlogger` with no arguments.
getlogger(::Nothing) = getlogger()
1 change: 1 addition & 0 deletions test/stdlib.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@testset "stdlib" begin
orig_logger = Base.CoreLogging.global_logger()
@test getlogger(nothing) == getlogger()

try
logger = getlogger("Memento")
Expand Down

2 comments on commit 916ea2e

@rofinn
Copy link
Member Author

@rofinn rofinn commented on 916ea2e Apr 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/59375

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.3.1 -m "<description of version>" 916ea2e9a0fec58bd162eba0c3d05d6c36dbee10
git push origin v1.3.1

Please sign in to comment.