Private
Loggers
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 messageString
logger::Logger
: the logger to log tolevel::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 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 aString
msg::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, 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 logargs
to.rec::Record
: aRecord
to log
Base.push!
— Method.push!(logger::Logger, handler::Handler)
Adds a new Handler
to the logger.
Base.push!
— Method.push!(logger::Logger, filter::Memento.Filter)
Adds an new Filter
to the logger.
Base.show
— Method.Base.show(::IO, ::Logger)
Just prints Logger(logger.name)
Memento.getchildren
— Method.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}
Memento.getlevels
— Method.getlevels(::Logger) -> Dict
Get the available log levels for a logger and their associated priorities.
Memento.getpath
— Method.getpath(logger::Logger) -> Vector{Logger}
Returns the path of logger from the root logger.
Memento.register
— Method.register(::Logger)
Register an existing logger with Memento if it has not already been registered.
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.getlevels
— Method.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.
Memento.setup_opts
— Method.setup_opts(opts) -> Dict
Sets the default :colors if opts[:is_colorized] == true
.
Formatters
Records
Base.Dict
— Method.Dict(rec::Record)
Extracts the Record
and its properties into a Dict
On AttributeRecord
s 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
.
Memento.Attribute
— Type.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.
Memento.Attribute
— Method.Attribute(f::Function) -> Attribute{Any}
Attribute{T}(f::Function) -> Attribute{T}
Creates an Attribute
with the given function.
Memento.Attribute
— Method.Attribute(x)
Simply wraps the value x
in Some
and sticks that in an Attribute
with an empty Function
.
Base.get
— Method.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
Memento.get_lookup
— Method.get_lookup(trace::Attribute{StackTrace})
Returns the top StackFrame
for trace
if it isn't empty.
Memento.get_trace
— Method.get_trace()
Returns the StackTrace
with StackFrame
s 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, IO
Grabs the next log file.
Memento.getsuffix
— Method.getsuffix(::Integer) -> String
Formats the nth file suffix.