pine
Types
Logger
opaqueThe logger type. This is opaque by default to prevent developers from relying on implementation details that may change.
pub opaque type Logger
Functions
pub fn format_plain() -> fn(Log) -> String
Creates a formatter that outputs to one line of plain text where each attribute is separated by a space.
pub fn new() -> Logger
Create a new Logger.
This uses the defaults of:
- plain format
- console transport
- debug level
pub fn set_format(
logger: Logger,
new_format: fn(Log) -> String,
) -> Logger
Sets the logger to the given format.
pub fn set_level(logger: Logger, new_level: Level) -> Logger
Sets the logger to the given level.
pub fn set_transport(
logger: Logger,
new_transport: fn(String) -> Nil,
) -> Logger
Sets the logger to the given transport.
pub fn transport_console() -> fn(String) -> Nil
Creates a transport that writes to the console.
pub fn transport_file(filename: String) -> fn(String) -> Nil
Creates a transport that writes the given file.
pub fn with_bool(
logger: Logger,
key: String,
value: Bool,
) -> Logger
Adds a new ‘bool’ attribute to a logger.
pub fn with_float(
logger: Logger,
key: String,
value: Float,
) -> Logger
Adds a new ‘float’ attribute to a logger.
pub fn with_int(
logger: Logger,
key: String,
value: Int,
) -> Logger
Adds a new ‘int’ attribute to a logger.
pub fn with_string(
logger: Logger,
key: String,
value: String,
) -> Logger
Adds a new ‘string’ attribute to a logger.