log+x86_64 +linux
log: general-purpose logging system
The log module provides a simple interface for application logging. The logger interface provides an abstraction that users may implement for custom logging logic. We provide a simple logger implementation that prefixes each line with the current timestamp; to initialize such a logger see new.
A global logger is also provided for simple applications to use, global, which is an instance of the standard logger that writes to os::stderr by default. The user may configure a new global logger via setlogger.
Index
Types
type logger; // Undocumented types: type stdlogger;
Globals
const default: *logger; let global: *logger; const silent: *logger;
Functions
fn fatal(fields: fmt::formattable...) never; fn fatalf(fmt: str, fields: fmt::field...) never; fn lfatal(log: *logger, fields: fmt::formattable...) never; fn lfatalf(log: *logger, fmt: str, fields: fmt::field...) never; fn lprintfln(log: *logger, fmt: str, fields: fmt::field...) void; fn lprintln(log: *logger, fields: fmt::formattable...) void; fn new(sink: io::handle) stdlogger; fn printfln(fmt: str, fields: fmt::field...) void; fn println(fields: fmt::formattable...) void; fn setlogger(log: *logger) void;
Types
type logger[permalink] [source]
type logger = struct { println: *fn(logger: *logger, fields: fmt::formattable...) void, printfln: *fn(logger: *logger, fmt: str, fields: fmt::field...) void, };
Interface for implementing a logger.
type stdlogger[permalink] [source]
Show undocumented member
type stdlogger = struct { logger, sink: io::handle, };
Globals
let default[permalink] [source]
const default: *logger;
Default logger that writes to os::stderr.
let global[permalink] [source]
let global: *logger;
The global logger instance.
let silent[permalink] [source]
const silent: *logger;
A logger that does not print any messages.
Functions
fn fatal[permalink] [source]
fn fatal(fields: fmt::formattable...) never;
Prints data to the global log with new line, then terminates the process.
fn fatalf[permalink] [source]
fn fatalf(fmt: str, fields: fmt::field...) never;
Formats and prints data to the global log with new line, then terminates the process.
fn lfatal[permalink] [source]
fn lfatal(log: *logger, fields: fmt::formattable...) never;
Prints data to the log with a newline, then terminates the process.
fn lfatalf[permalink] [source]
fn lfatalf(log: *logger, fmt: str, fields: fmt::field...) never;
Formats and prints data to the log with new line, then terminates the process.
fn lprintfln[permalink] [source]
fn lprintfln(log: *logger, fmt: str, fields: fmt::field...) void;
Formats and prints data to the log, with a newline.
fn lprintln[permalink] [source]
fn lprintln(log: *logger, fields: fmt::formattable...) void;
Prints data to the log, with a newline.
fn new[permalink] [source]
fn new(sink: io::handle) stdlogger;
Creates a new standard logger.
fn printfln[permalink] [source]
fn printfln(fmt: str, fields: fmt::field...) void;
Formats and prints data to the global log, with a newline.
fn println[permalink] [source]
fn println(fields: fmt::formattable...) void;
Prints data to the global log, with a newline.
fn setlogger[permalink] [source]
fn setlogger(log: *logger) void;
Sets the global logger instance to the provided logger.