data log
Namespace of the logging functions: log.info("…").
Example:
use std.obs { log }
fn main() io {
let id = 42
log.info("order {id} paid")
print("logged")
}Output
logged
pub(api) data logThread safety. safe from any task; records of different tasks may interleave, each one is written whole.
Since. 1.0.0-beta
Methods
trace | (msg: str) ioVery detailed diagnostics. |
debug | (msg: str) ioDiagnostics for developers. |
info | (msg: str) ioNormal events worth recording. |
warn | (msg: str) ioSomething unexpected that the program handled. |
error | (msg: str) ioAn operation failed. |
at | (level: Level, msg: str) ioLogs at a level chosen at run time (log.at(Level.Warn, "…")). |
level | () -> Level ioCurrent threshold |
setLevel | (level: Level) ioChanges the threshold of this process (the start-up value comes from --log-level / OXL_LOG). |
enabled | (level: Level) -> bool ioTrue when a record at level would be written; guard expensive field computation with it. |
setJson | (on: bool) ioSwitches between text (false) and JSON-lines (true) output. |
isJson | () -> bool ioTrue when the output is JSON lines. |
Defined in: std/obs/obs.oxl:101