Skip to content
FutureBlitz

    Install

    Import std.log.logger

    std.log.logger

    Logger, which writes lines for a module at levels, with fields, to a LogOutput: the default one, which writes readable lines to stderr at the levels FB_LOG sets, or one the program makes, with sinks of its own. Loggers and LogOutputs are Shared Classes, so any thread can log, and a Logger with a field is a new Logger, so threads never change one another's.

    std/log/logger.fb

    Types

    Logger class

    Public Shared Class Logger

    Writes lines for a module, with the fields it's given, at levels, to an output. Its Trace, Debug, Info, Warn, and Error write a line at their level, when the output's filter writes that level for the module.

    std/log/logger.fb, line 45

    • Public New(module: String) constructor #

      A Logger for module, a name like "net.http" whose dots say what it's in, which writes to the default output.

    • Public New(module: String, output: LogOutput) constructor #

      A Logger for module that writes to output.

    • Public Property Module: String property #

      The module it writes for.

    • Public Property Fields: ImmutableArray<LogField> property #

      The fields each of its lines has, in the order they were given.

    • Public Method With(name: String, value: String): Logger method #

      A Logger like this one whose lines have the field too, after its others.

    • Public Method With(name: String, value: Int8): Logger method #

      An integer of each of the eight types, as its number.

    • Public Method With(name: String, value: Int16): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: Int): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: Int64): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: UInt8): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: UInt16): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: UInt32): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: UInt64): Logger method #

      A Logger whose lines have the field name, of value's number, beside this one's.

    • Public Method With(name: String, value: Float64): Logger method #

      A Double that isn't finite is text, since JSON has no number for it: "inf", "-inf", or "nan", whatever a NaN's sign bit.

    • Public Method With(name: String, value: Bool): Logger method #

      A Logger whose lines have the field name, true or false, beside this one's.

    • Public Method IsEnabled(level: LogLevel): Bool method #

      Whether a line at level would be written, so code can leave out work that only a line would use.

    • Public Method Log(level: LogLevel, message: String) method #

      Writes message at level, now, when the output's filter writes it.

    • Public Method Trace(message: String) method #

      Writes message at TRACE, as Log does.

    • Public Method Debug(message: String) method #

      Writes message at DEBUG, as Log does.

    • Public Method Info(message: String) method #

      Writes message at INFO, as Log does.

    • Public Method Warn(message: String) method #

      Writes message at WARN, as Log does.

    • Public Method Error(message: String) method #

      Writes message at ERROR, as Log does.

    Functions

    DefaultLogOutput function

    Public Function DefaultLogOutput(): LogOutput

    The default output, made the first time a Logger uses it: the console's sink, at the levels FB_LOG sets, or at INFO when it isn't set. An FB_LOG that isn't a filter is said once on stderr, and left out.

    std/log/logger.fb, line 21

    Report an issue with this page or with FutureBlitz on GitHub.