Struct artifact::logger::Logger
[−]
[src]
pub struct Logger { // some fields omitted }
A logger within the Artifact logging library. This struct is somewhat similar to an address. The struct itself only stores the name of the logger. However, the initialization functions tell the backend what kind of logger it is, what level it logs at, and other interesting information.
Methods
impl Logger
fn set_default_formatter(fmtr: Box<MessageFormatter>)
Sets the default formatter. This formatter will be used by any logger which does not have a formatter set for it.
fn access(name: &str) -> Logger
Creates a Logger instance, but does not tell the backend to initialize the logger.
fn access_internal_logger() -> Logger
Accesses the Artifact library's internal logger. This can be redirected or reformatted to cause the internal logger to log however you need. By default, the internal logger logs to stdout.
fn new(name: &str, ty: LoggerOutput) -> Logger
Creates a logger which will log to the given output. This tells the backend logger task to initialize the logger.
fn new_with_level(name: &str, ty: LoggerOutput, level: LogLevel) -> Logger
Creates a logger for the given output which logs messages at or above the given level. This also initializes the logger by telling the backend task.
fn redirect(&self, ty: LoggerOutput)
Redirects a logger to a new output location. Returns the logger as well
fn redirect_set_level(&self, ty: LoggerOutput, level: LogLevel)
Redirects a logger and changes its level Returns the logger
fn disable(self)
Prevents use of a logger name, and kills off any existing logger instances with that name
fn disable_without_logs(self)
Prevents use of a logger name, kills off any existing loggers with that name, and disables logging info about that logger entirely.
fn set_as_default(&self)
Sets the default logger to be this logger.
fn set_as_silent_default(&self)
Sets the default logger to be this logger, silently. This means that all logs to an unknown logger will be directed to this logger. However, no addition to the message will be made by this logger.
fn set_format(&self, formatter: Box<MessageFormatter>)
Sets the logger's format
fn log(&self, level: LogLevel, message: &str)
Creates a new log message. This just sends a message across the backend channel to the actual logger task.