Skip to content
CryoCryo home
Stdliblog

record

import std::log::record; · source

A log record and its level: what a Logger hands a LogSink.

Types

LogLevel

type enum LogLevel with [Eq, Clone, Debug] {
    Error;
    Warning;
    Information;
    Debug;
    Trace;
}

How much a record matters, from Error, the most, to Trace, the least. A level setting lets through records at that level and every level above it: Warning passes errors and warnings, which allows answers — LogLevel::Warning.allows(&LogLevel::Error) is true.

parse reads a level's name ignoring ASCII case — error, warning, information, debug or trace — and name writes it in lower case, as Display does.

Variants

Variant
Error
Warning
Information
Debug
Trace

Constructors

static parse(name: Str) -> Option<LogLevel>;

The level a name spells, ignoring ASCII case: error, warning, information, debug or trace; None for any other text.

Methods

name(&this) -> Str;

The level's name, in lower case, as parse reads it.

allows(&this, level: &LogLevel) -> boolean;

True when a setting of this lets a record at level through.

Trait implementations

implement trait Display for enum LogLevel

LogRecord

type struct LogRecord {
    level:    LogLevel;
    area:     Str;
    message:  Arguments;
    location: Location;
    time:     SystemTime;
}

One thing logged: its level, the area of the Logger that logged it, the message, where the logging call is written, and when it was made. The message is an Arguments that borrows the values the logging call was given, so it is formatted only during the LogSink.write call the record is passed to, never after.

Properties

PropertyTypeNotes
levelLogLevel
areaStrThe area of the Logger that logged it.
messageArguments
locationLocationWhere the logging call is written.
timeSystemTime