Expand description
This module is used for logging.
It logs directly to stderr, prefixing log entries
with their log level:
>F: Failed to load config files:
F: IO Error: No such file or directory (os error 2)For multiline logs, each line gets the log level prefix,
but only the first line starts with a >.
§Log Levels
If a certain log level is selected, all logs of this level or above will be shown in the output.
- Fatal
- Error
- Warning
- Info
- Debug
§Usage
log::<loglevel>!(<format string>[, <format arguments>]*; <prefix>);Where
loglevelisfatal,error,warning,info, ordebugformat stringandformat argumentswork like they do inprintln!, i.e. ifprintln!(...)is valid, then so islog::_!(...; pfx)
§Prefix
The prefix is used to give context to a log entry. It can contain a lobby and/or player id which will then be shown when logging.
§Examples:
log::info!("doing thing now"; &log::pfx());log::info!("generated not-random value {}", 42; &log::pfx());let mut pfx = log::pfx();
pfx.lobby(todo!("obtain a lobby id"));
log::info!("my log {}", "message"; &pfx);See also: Prefix
Re-exports§
Modules§
- _impl
- uuid_
human_ hash - A way to “hash” the 128-bit UUIDs into two 3-letter words, such as
eat-fox, so that humans can more easily refer to lobbies or players (instead of having to read the hex-representation of the UUIDs).
Macros§
Functions§
- pfx
- returns a log prefix containing no information.