Private

Private

Loggers

Base.logMethod.
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 message String
  • logger::Logger: the logger to log to
  • level::AbstractString: the log level as a String

Throws

  • CompositeException: may be thrown if an error occurs in one of the handlers (which are run with @async)
source
Base.logMethod.
log(logger::Logger, level::AbstractString, msg::AbstractString)

Creates a Record 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 Record).

Arguments

  • logger::Logger: the logger to log to.
  • level::AbstractString: the log level as a String
  • msg::AbstractString: the msg to log as a String

Throws

  • CompositeException: may be thrown if an error occurs in one of the handlers (which are run with @async)
source
Base.logMethod.
log(logger::Logger, rec::Record)

Logs rec to all its logger handlers. 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 it with a @sync in order to synchronize all handler tasks.

Arguments

  • logger::Logger: the logger to log args to.
  • rec::Record: a Record to log
source
Base.push!Method.
push!(logger::Logger, handler::Handler)

Adds a new Handler to the logger.

source
Base.push!Method.
push!(logger::Logger, filter::Memento.Filter)

Adds an new Filter to the logger.

source
Base.showMethod.
Base.show(::IO, ::Logger)

Just prints Logger(logger.name)

source
getchildren(name)

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: the name of the logger.

Returns

  • Vector{Logger}
source
Memento.getlevelsMethod.
getlevels(::Logger) -> Dict

Get the available log levels for a logger and their associated priorities.

source
Memento.getpathMethod.
getpath(logger::Logger) -> Vector{Logger}

Returns the path of logger from the root logger.

source
Memento.registerMethod.
register(::Logger)

Register an existing logger with Memento if it has not already been registered.

source

Handlers

Base.logMethod.
log(handler::Handler, rec::Record)

Checks the Handler filters and if they all pass then emit the record.

source
Base.push!Method.
push!(handler::DefaultHandler, filter::Memento.Filter)

Adds an new Filter to the handler.

source
Memento.getlevelsMethod.
getlevels(::Handler) -> Union{Dict, Nothing}

Get the available log levels for a handler and their associated priorities. The default is nothing, for handlers which do not perform level-based filtering.

source
Memento.setup_optsMethod.
setup_opts(opts) -> Dict

Sets the default :colors if opts[:is_colorized] == true.

source

Formatters

Records

Base.DictMethod.
Dict(rec::Record)

Extracts the Record and its properties into a Dict

Warn

On AttributeRecords 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.

source
Attribute

An Attribute represents a lazily evaluated field in a log Record.

Fields

  • f::Function: A function to evaluate in order to get a value if one is not set.
  • x::Union{Some{T}, Nothing}: A value that may or may not exist yet.
source
Memento.AttributeMethod.
Attribute(f::Function) -> Attribute{Any}
Attribute{T}(f::Function) -> Attribute{T}

Creates an Attribute with the given function.

source
Memento.AttributeMethod.
Attribute(x)

Simply wraps the value x in Some and sticks that in an Attribute with an empty Function.

source
Base.getMethod.
get(attr::Attribute{T}) -> T

Run 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

source
Memento.get_lookupMethod.
get_lookup(trace::Attribute{StackTrace})

Returns the top StackFrame for trace if it isn't empty.

source
Memento.get_traceMethod.
get_trace()

Returns the StackTrace with StackFrames from the Memento module filtered out.

source

IO

Base.flushMethod.
flush(::FileRoller)

Flushes the current open file.

source
Base.printlnMethod.
println(::FileRoller, ::AbstractString)

Writes the string to a file and creates a new file if we've reached the max file size.

source
Memento.getfileMethod.
getfile(folder::AbstractString, prefix::AbstractString) -> String, IO

Grabs the next log file.

source
Memento.getsuffixMethod.
getsuffix(::Integer) -> String

Formats the nth file suffix.

source