Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare level type for default_metafmt #37843

Merged
merged 1 commit into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function logmsg_code(_module, file, line, level, message, exs...)
let
level = $level
std_level = convert(LogLevel, level)
if std_level >= getindex(_min_enabled_level)
if std_level >= _min_enabled_level[]
group = $(log_data._group)
_module = $(log_data._module)
logger = current_logger_for_env(std_level, group, _module)
Expand Down Expand Up @@ -458,7 +458,7 @@ function logmsg_shim(level, message, _module, group, id, file, line, kwargs)
end

# Global log limiting mechanism for super fast but inflexible global log limiting.
const _min_enabled_level = Ref(Debug)
const _min_enabled_level = Ref{LogLevel}(Debug)

# LogState - a cache of data extracted from the logger, plus the logger itself.
struct LogState
Expand Down
4 changes: 2 additions & 2 deletions stdlib/Logging/src/ConsoleLogger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ function showvalue(io, e::Tuple{Exception,Any})
end
showvalue(io, ex::Exception) = showerror(io, ex)

function default_logcolor(level)
function default_logcolor(level::LogLevel)
level < Info ? Base.debug_color() :
level < Warn ? Base.info_color() :
level < Error ? Base.warn_color() :
Base.error_color()
end

function default_metafmt(level, _module, group, id, file, line)
function default_metafmt(level::LogLevel, _module, group, id, file, line)
@nospecialize
color = default_logcolor(level)
prefix = (level == Warn ? "Warning" : string(level))*':'
Expand Down