Well, you do not have the line:
import Base: show
Perhaps that makes the difference. But I have another issue:
The trace macro doesn’t work yet:
using Logging
import Base: show
const Trace = LogLevel(500)
macro _sourceinfo()
esc(quote
(__module__,
__source__.file === nothing ? "?" : String(__source__.file),
__source__.line)
end)
end
macro trace(exs...) logmsg_code((@_sourceinfo)..., :Trace, exs...) end
function show(io::IO, level::LogLevel)
if level == Logging.Debug print(io, "Debug")
elseif level == Logging.Info print(io, "Info")
elseif level == Trace print(io, "Trace")
elseif level == Logging.Warn print(io, "Warn")
elseif level == Logging.Error print(io, "Error")
else print(io, "LogLevel($(level.level))")
end
end
logger = ConsoleLogger(stdout, Logging.Info) # Warn or Info or Debug
global_logger(logger)
@logmsg Trace "A trace message ..."
@trace "Even better..."
Error message:
[ Trace: A trace message ...
ERROR: LoadError: LoadError: UndefVarError: logmsg_code not defined
Ok, I could copy and past the whole CoreLogging module, but why am I not able to import any function from this module?