Skip to content

Commit

Permalink
make custom log macros work
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Nov 16, 2023
1 parent d4e0acf commit c4b44af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -374,23 +374,23 @@ function logmsg_code(_module, file, line, level, message, exs...)
let
level = $level
# simplify std_level code emitted, if we know it is one of our global constants
std_level = $(level isa Symbol ? :level : :(level isa LogLevel ? level : convert(LogLevel, level)::LogLevel))
if std_level >= _min_enabled_level[]
std_level = $(level isa Symbol ? :level : :(level isa Base.CoreLogging.LogLevel ? level : convert(Base.CoreLogging.LogLevel, level)::Base.CoreLogging.LogLevel))
if std_level >= Base.CoreLogging._min_enabled_level[]
group = $(log_data._group)
_module = $(log_data._module)
logger = current_logger_for_env(std_level, group, _module)
logger = Base.CoreLogging.current_logger_for_env(std_level, group, _module)
if !(logger === nothing)
id = $(log_data._id)
# Second chance at an early bail-out (before computing the message),
# based on arbitrary logger-specific logic.
if invokelatest(shouldlog, logger, level, _module, group, id)
if invokelatest(Base.CoreLogging.shouldlog, logger, level, _module, group, id)
file = $(log_data._file)
if file isa String
file = Base.fixup_stdlib_path(file)
end
line = $(log_data._line)
local msg, kwargs
$(logrecord) && invokelatest(handle_message,
$(logrecord) && invokelatest(Base.CoreLogging.handle_message,
logger, level, msg, _module, group, id, file, line;
kwargs...)
end
Expand Down

0 comments on commit c4b44af

Please sign in to comment.