Private
Loggers
Base.info — Function.info(logger::Logger, msg::AbstractString)Logs the message at the info level.
info(msg::Function, logger::Logger)Logs the message produced by the provided function at the info level.
Base.log — Method.log(::Function, ::Logger, ::AbstractString)Same as log(logger, level, msg), but in this case the message can be a function that returns the log message string.
Arguments
msg::Function: a function that returns a messageStringlogger::Logger: the logger to log to.level::AbstractString: the log level as aString
Throws
CompositeException: may be thrown if an error occurs in one of the handlers (which are run with@async)
Base.log — Method.log(logger::Logger, level::AbstractString, msg::AbstractString)Creates a Dict with the logger name, level, levelnum and message and calls the other log method (which may recursively call itself on parent loggers with the created Dict).
Arguments
logger::Logger: the logger to log to.level::AbstractString: the log level as aStringmsg::AbstractString: the msg to log as aString
Throws
CompositeException: may be thrown if an error occurs in one of the handlers (which are run with@async)
Base.log — Method.log(logger::Logger, args::Dict{Symbol, Any})Logs logger.record(args) to its handlers if it has the appropriate args[:level] and args[:level] is above the priority of logger.level. If this logger is not the root logger and logger.propagate is true then the parent logger is called.
NOTE: This method calls all handlers asynchronously and is recursive, so you should call this method with a @sync in order to synchronize all handler tasks.
Arguments
logger::Logger: the logger to logargsto.args::Dict: a dict of msg fields and values that should be passed tologger.record.
Base.push! — Method.push!(logger::Logger, filter::Memento.Filter)Adds an new Filter to the logger.
Base.push! — Method.push!(logger::Logger, handler::Handler)Adds a new Handler to the logger.
Base.show — Method.Base.show(::IO, ::Logger)Just prints Logger(logger.name)
Base.warn — Function.warn(logger::Logger, msg::AbstractString)Logs the message at the warn level.
warn(msg::Function, logger::Logger)Logs the message produced by the provided function at the warn level.
Base.warn — Method.warn(logger::Logger, exc::Exception)Takes an exception and logs it. If the exception is a CompositeException, each contained exception is logged.
Memento.config! — Method.config!([logger], level; fmt::AbstractString, levels::Dict{AbstractString, Int}, colorized::Bool) -> LoggerSets the Memento._log_levels, creates a default root logger with a DefaultHandler that prints to stdout.
Arguments
'logger::Union{Logger, AbstractString}`: The logger to configure (optional)
level::AbstractString: the minimum logging level to log message to the root logger (required).fmt::AbstractString: a format string to pass to theDefaultFormatterwhich describes how to log messages (defaults toMemento.DEFAULT_FMT_STRING)levels: the default logging levels to use (defaults toMemento._log_levels).colorized: whether or not the message to stdout should be colorized.
Returns
Logger: the root logger.
Memento.getchildren — Method.getchildren(name::AbstractString)Takes a string representing the name of a logger and returns its children. Child loggers are extracted assuming a naming convention of "foo.bar.baz", where "foo.bar.baz" is the child of "foo.bar" which is the child of "foo".
Arguments
name::AbstractString: the name of the logger.
Returns
Vector{Logger}
Memento.getparent — Method.getparent(name::AbstractString) -> LoggerTakes a string representing the name of a logger and returns its parent. If the logger name has no parent then the root logger is returned. Parent loggers are extracted assuming a naming convention of "foo.bar.baz", where "foo.bar.baz" is the child of "foo.bar" which is the child of "foo".
Arguments
name::AbstractString: the name of the logger.
Returns
Logger: the parent logger.
Memento.register — Method.register(::Logger)Register an existing logger with Memento.
Memento.reset! — Method.reset!()Removes all registered loggers and reinitializes the root logger without any handlers.
Handlers
Base.log — Method.log(handler::Handler, rec::Record)Checks the Handler filters and if they all pass then emit the record.
Base.push! — Method.push!(handler::DefaultHandler, filter::Memento.Filter)Adds an new Filter to the handler.
Memento.setup_opts — Method.setup_opts(opts) -> DictSets the default :colors if opts[:is_colorized] == true.
Formatters
Records
Base.Dict — Method.Dict(rec::Record)Extracts the Record and its Attributes into a Dict
This may be an expensive operation, so you probably don't want to do this for every log record unless you're planning on using every Attribute.
Base.get — Method.get(attr::Attribute{T}) -> TRun set attr.x to the output of attr.f if attr.x is not already set. We then return the value stored in attr.x
Memento.get_lookup — Method.get_lookup(trace::Attribute{StackTrace})Returns the top StackFrame for trace if it isn't empty.
Memento.get_msg — Method.get_msg(msg) -> FunctionWraps msg in a function if it is a String.
Memento.get_trace — Method.get_trace()Returns the StackTrace with StackFrames from the Memento module filtered out.
IO
Base.flush — Method.flush(::FileRoller)Flushes the current open file.
Base.println — Method.println(::FileRoller, ::AbstractString)Writes the string to a file and creates a new file if we've reached the max file size.
Memento.getfile — Method.getfile(folder::AbstractString, prefix::AbstractString) -> String, IOGrabs the next log file.
Memento.getsuffix — Method.getsuffix(::Integer) -> StringFormats the nth file suffix.