Skip to content
FutureBlitz

    Install

    Import std.log.level

    LogFilter

    std.log.level

    struct

    Public Struct LogFilter Implements Printable

    The least level written for each module: its own, when it has one, or the nearest module's it's in, so "net.http.client" has "net.http"'s or else "net"'s, or else the base level that every other module has. It's Sendable, so a LogOutput shares it with every thread.

    Examples

    Local filter = LogFilter.Parse("info,net=trace,net.http=off")
    Expect(filter?.LevelOf("app") == LogLevel.INFO)
    Expect(filter?.LevelOf("net.tcp") == LogLevel.TRACE)
    Expect(filter?.Allows("net.http.client", LogLevel.ERROR) == False)
    Expect(LogFilter.At(LogLevel.WARN).With("db", LogLevel.DEBUG).ToString() == "warn,db=debug")

    std/log/level.fb, line 63

    • Public Static Method At(level: LogLevel): LogFilter static method #

      Every module at level.

    • Public Static Method Parse(text: String): LogFilter? static method #

      FB_LOG's text: parts between commas, each a level, which every module gets, or a module, an '=', and its level, with spaces around them left out. Every module is at INFO unless a part says otherwise, and the last part wins. Null when a part is neither, or a module's name is empty.

    • Public Method With(module: String, level: LogLevel): LogFilter method #

      The same filter, with module, and the modules in it that have no level of their own, at level.

    • Public Property Level: LogLevel property #

      The level every module without one of its own has.

    • Public Method LevelOf(module: String): LogLevel method #

      The least level written for module: its own, or the nearest module's it's in, or the base.

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

      Whether a line at level, which isn't OFF, is written for module.

    • Public Method ToString(): String method #

      As FB_LOG's text has it, its modules by name: "info,net=trace".

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