Skip to content
Merged
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
99 changes: 28 additions & 71 deletions stdlib/Logging/src/Logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,70 +8,33 @@ and available by default.
"""
module Logging

# Import the CoreLogging implementation into Logging as new const bindings.
# Doing it this way (rather than with import) makes these symbols accessible to
# tab completion.
for sym in [
:LogLevel,
:AbstractLogger,
:NullLogger,
:handle_message, :shouldlog, :min_enabled_level, :catch_exceptions,
Symbol("@debug"),
Symbol("@info"),
Symbol("@warn"),
Symbol("@error"),
Symbol("@logmsg"),
:with_logger,
:current_logger,
:global_logger,
:disable_logging,
:SimpleLogger]
@eval const $sym = Base.CoreLogging.$sym
end

# LogLevel aliases (re-)documented here (JuliaLang/julia#40978)
"""
Debug

Alias for [`LogLevel(-1000)`](@ref LogLevel).
"""
const Debug = Base.CoreLogging.Debug
"""
Info

Alias for [`LogLevel(0)`](@ref LogLevel).
"""
const Info = Base.CoreLogging.Info
"""
Warn

Alias for [`LogLevel(1000)`](@ref LogLevel).
"""
const Warn = Base.CoreLogging.Warn
"""
Error

Alias for [`LogLevel(2000)`](@ref LogLevel).
"""
const Error = Base.CoreLogging.Error
"""
BelowMinLevel

Alias for [`LogLevel(-1_000_001)`](@ref LogLevel).
"""
const BelowMinLevel = Base.CoreLogging.BelowMinLevel
"""
AboveMaxLevel

Alias for [`LogLevel(1_000_001)`](@ref LogLevel).
"""
const AboveMaxLevel = Base.CoreLogging.AboveMaxLevel

using Base.CoreLogging:
closed_stream, ConsoleLogger, default_metafmt

# Some packages use `Logging.default_logcolor`
const default_logcolor = Base.CoreLogging.default_logcolor
import Base.CoreLogging:
LogLevel,
AbstractLogger,
NullLogger,
handle_message, shouldlog, min_enabled_level, catch_exceptions,
var"@debug",
var"@info",
var"@warn",
var"@error",
var"@logmsg",
with_logger,
current_logger,
global_logger,
disable_logging,
SimpleLogger,
Debug,
Info,
Warn,
Error,
BelowMinLevel,
AboveMaxLevel,
default_logcolor,
closed_stream,
ConsoleLogger,
default_metafmt,
# Some packages use `Logging.default_logcolor`
default_logcolor

export
AbstractLogger,
Expand All @@ -95,12 +58,6 @@ export
Error,
AboveMaxLevel

# The following are also part of the public API, but not exported:
#
# 1. Log levels:
# BelowMinLevel, Debug, Info, Warn, Error, AboveMaxLevel,
#
# 2. AbstractLogger message related functions:
# handle_message, shouldlog, min_enabled_level, catch_exceptions,
public handle_message, shouldlog, min_enabled_level, catch_exceptions

end