Skip to content
FutureBlitz

    Install

    Import std.log.output

    std.log.output

    What a Logger writes, and where: a LogRecord, with its LogFields, for each line, given to each sink of a LogOutput whose filter writes it.

    std/log/output.fb

    Types

    LogField struct

    Public Struct LogField

    One of a line's fields: its name and the text of its value, which a JSON line quotes when it's text, and writes as it is when it's a number or a Bool.

    std/log/output.fb, line 11

    • Public ReadOnly Field Name: String field #

      The field's name.

    • Public ReadOnly Field Text: String field #

      The text of its value.

    • Public ReadOnly Field IsText: Bool field #

      Whether its value is text, which a JSON line quotes, rather than a number or a Bool.

    • Public New(name: String, text: String, isText: Bool = True) constructor #

      A field name of text, which is a number's or a Bool's when isText is False.

    LogRecord struct

    Public Struct LogRecord

    A line, as a Logger gives it to its output's sinks.

    std/log/output.fb, line 28

    • Public ReadOnly Field Time: Timestamp field #

      When it was written.

    • Public ReadOnly Field Level: LogLevel field #

      How much it matters.

    • Public ReadOnly Field Module: String field #

      The module of the Logger that wrote it.

    • Public ReadOnly Field Message: String field #

      What it says.

    • Public ReadOnly Field Fields: ImmutableArray<LogField> field #

      Its fields, the Logger's and its own.

    • Public New(time: Timestamp, level: LogLevel, module: String, message: String) constructor #

      A line of message, at level, from module, at time, without fields.

    • Public New(time: Timestamp, level: LogLevel, module: String, message: String, fields: ImmutableArray<LogField>) constructor #

      A line of message, at level, from module, at time, with fields.

    LogOutput class

    Public Shared Class LogOutput

    Where Loggers' lines go: to each of its sinks, in the order they were added, once its filter writes the line's level for its module. Each sink gets the lines of every thread that logs, at once, so it must take them at once, as the console's does.

    std/log/output.fb, line 62

    • Public New(filter: LogFilter) constructor #

      An output with no sinks, whose filter is filter.

    • Public Method Add(sink: Sendable Func(LogRecord)) method #

      Adds sink, which each line written after this goes to, after the sinks added before it.

    • Public Method Clear() method #

      Takes every sink out, so lines go nowhere until one is added.

    • Public Property Filter: LogFilter property #

      The filter, which says what's written, or a new one, which the lines logged after it go by.

    • Public Method Allows(module: String, level: LogLevel): Bool method #

      Whether its filter writes a line at level for module.

    • Public Method Write(record: LogRecord) method #

      Gives record to each sink, if its filter writes it. The sinks are called outside the lock, so one can log, or add a sink, which the next line goes to.

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