GeoLeaf Core API - v3.19.0
    Preparing search index...

    Interface LogImplInterface

    The shape of GeoLeaf.Log — a level-filtered console with repetition damping.

    Two independent mechanisms decide whether a call reaches the console: the level threshold (LogImplInterface.setLevel) and, for messages recognised as repetitive, a grouping counter that suppresses them after a few occurrences and reports the totals through LogImplInterface.showSummary. A message can therefore be dropped even at a permissive level.

    What reaches the console is also recorded — and warnings and errors always are, whatever the level: LogImplInterface.getEntries reads that record back.

    interface LogImplInterface {
        setLevel(level: string): void;
        getLevel(): number;
        getLevelName(): string;
        setQuietMode(enabled: boolean): void;
        showSummary(): void;
        debug(...args: unknown[]): void;
        info(...args: unknown[]): void;
        warn(...args: unknown[]): void;
        error(...args: unknown[]): void;
        getEntries(): LogEntry[];
        exportDiagnostic(): string;
    }
    Index
    • Sets the verbosity threshold.

      Accepts "debug", "info", "warn", "error" and "production", case-insensitively. ⚠️ "production" is not a level of its own: it sets the threshold to warn and turns quiet mode on, so it is the only value with a side effect beyond the threshold. An unrecognised value logs a warning and leaves the level unchanged.

      Parameters

      • level: string

        The level name.

      Returns void

      GeoLeaf.Log.setLevel("debug");
      
      GeoLeaf.Log.setLevel("production");
      // Equivalent to: setLevel('warn') + setQuietMode(true)
    • The current threshold, as its numeric value from LEVELS.

      Returns number

      0 (DEBUG), 1 (INFO), 2 (WARN) or 3 (ERROR).

      const level = GeoLeaf.Log.getLevel();
      // Returns: 0 (DEBUG) | 1 (INFO) | 2 (WARN) | 3 (ERROR)
    • The current threshold, as its name.

      ⚠️ Reports the threshold, not the mode: after setLevel("production") this returns "WARN", and nothing here reveals that quiet mode was switched on with it.

      Returns string

      "DEBUG", "INFO", "WARN" or "ERROR".

      const name = GeoLeaf.Log.getLevelName();
      // Returns: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
    • Turns repetition damping on or off, independently of the level.

      With it on, messages matching the module's repetitive-message patterns are shown a couple of times and then counted silently until LogImplInterface.showSummary.

      Parameters

      • enabled: boolean

        true to damp repetitive messages.

      Returns void

      GeoLeaf.Log.setQuietMode(true);
      // [GeoLeaf.INFO] Silent mode activated - repetitive logs reduced
    • Prints how many times each damped message was suppressed.

      The counterpart of quiet mode: without this call, the suppressed occurrences are never reported at all.

      Returns void

      GeoLeaf.Log.showSummary();
      // [GeoLeaf.INFO] Grouped log summary
      // • 12x: Module loaded...
      // • 8x: Profile loaded...
    • Logs at DEBUG — internal detail, off by default (the default threshold is INFO).

      Parameters

      • ...args: unknown[]

        Values forwarded to the console, prefixed with the module tag.

      Returns void

      GeoLeaf.Log.debug("[GeoLeaf.GeoJSON] Loading features…");
      
    • Logs at INFO — normal lifecycle events. Subject to repetition damping.

      Parameters

      • ...args: unknown[]

        Values forwarded to the console, prefixed with the module tag.

      Returns void

      GeoLeaf.Log.info("[GeoLeaf.Core] Map initialised.");
      
    • Logs at WARN — a degraded path was taken, but the operation continued.

      Parameters

      • ...args: unknown[]

        Values forwarded to the console, prefixed with the module tag.

      Returns void

      GeoLeaf.Log.warn("[GeoLeaf.Config] Key 'basemap.id' missing, falling back to 'street'.");
      
    • Logs at ERROR — the highest level, never damped by quiet mode.

      Parameters

      • ...args: unknown[]

        Values forwarded to the console, prefixed with the module tag.

      Returns void

      GeoLeaf.Log.error("[GeoLeaf.Config] Configuration loading failed.");
      
    • The recent entries of the log's record, oldest first — at most 500, secrets redacted.

      Warnings and errors are recorded whatever the level; info and debug when they reach the console. The boot logger feeds the same record, and so do uncaught errors and unhandled rejections from GeoLeaf.boot() on. Unlike the console, the record is readable without developer tools: it is what the boot failure screen hands over in its diagnostic.

      Returns LogEntry[]

      A copy: changing it changes nothing in the record.

      const errors = GeoLeaf.Log.getEntries().filter((entry) => entry.level === "error");
      
    • The recent entries as a JSON document, ready to hand to support.

      Returns string

      { format: "geoleaf-log", formatVersion: 1, time, level, entries }, pretty-printed, where level is the current threshold and entries what LogImplInterface.getEntries returns.

      const report = GeoLeaf.Log.exportDiagnostic();