enumstd.log.Level[src]

Fields

err

Error: something has gone wrong. This might be recoverable or might be followed by the program exiting.

warn

Warning: it is uncertain if something has gone wrong or not, but the circumstances would be worth investigating.

info

Info: general messages about the state of the program.

debug

Debug: messages only useful for debugging.

Functions

FunctionasText[src]

pub fn asText(comptime self: Level) []const u8

Returns a string literal of the given level in full text form.

Parameters

self: Level

Source Code

Source code
pub fn asText(comptime self: Level) []const u8 {
    return switch (self) {
        .err => "error",
        .warn => "warning",
        .info => "info",
        .debug => "debug",
    };
}

Source Code

Source code
pub const Level = enum {
    /// Error: something has gone wrong. This might be recoverable or might
    /// be followed by the program exiting.
    err,
    /// Warning: it is uncertain if something has gone wrong or not, but the
    /// circumstances would be worth investigating.
    warn,
    /// Info: general messages about the state of the program.
    info,
    /// Debug: messages only useful for debugging.
    debug,

    /// Returns a string literal of the given level in full text form.
    pub fn asText(comptime self: Level) []const u8 {
        return switch (self) {
            .err => "error",
            .warn => "warning",
            .info => "info",
            .debug => "debug",
        };
    }
}