ChemPal Documentation - v1.18.0
    Preparing search index...

    Module utils/Logger

    Types - Utils

    RemoteLogLevel

    A severity bucket a remote log sink can opt into.

    isRemoteLogLevel

    Narrows an arbitrary value to a RemoteLogLevel.

    RemoteLogRecord

    One log call as handed to a RemoteLogSink.

    • level - The remote severity bucket of the call.
    • prefix - The emitting logger's prefix (includes any sub() segments).
    • message - The message passed to the logger, before any formatting.
    • args - The extra arguments passed to the logger, unsanitized.
    • location - Where the call lives in the source, as path:line#function, when the build recorded it (see tools/logCallSites.js); otherwise undefined.
    • context - Key/value pairs describing what the app was doing when the call was made, such as the active search query (see Logger.setContext); undefined when there are none.
    RemoteLogSink

    A destination that receives log calls in addition to the console, such as PostHog Logs. isEnabled is checked first so a disabled level costs no more than one function call.

    • isEnabled - Whether records at this level are currently wanted.
    • emit - Receives a record. Must not throw.

    Classes - Utils

    Logger

    A simple logger that works on both the commandline and in the browser, and can directly replace the console object (for most cases).

    Constants - Utils

    REMOTE_LOG_LEVELS

    Every severity bucket a remote log sink can opt into, least to most severe. Logger.info and Logger.log both map to 'log'.

    Enumerations - Utils

    LogLevel

    Available logging levels in ascending order of severity: TRACE → DEBUG → INFO → WARN → ERROR → FATAL