emit function

Last updated: 2026-03-01T23:25:47.125Z

Metrics

LOC: 20 Complexity: 4 Params: 4

Signature

emit( level: LogLevel | "group", prefix: string, args: unknown[], ): : void

Source Code

function emit(
  level: LogLevel | "group",
  prefix: string,
  args: unknown[],
): void {
  if (initializing) {
    buffer.push({ level, prefix, args });
    return;
  }
  const lvl: LogLevel = level === "group" ? "debug" : level;
  if (!shouldLog(lvl)) return;

  const logEntry: LogEntry = {
    ts: new Date().toISOString(),
    level: lvl,
    ns: prefix,
    msg: formatArgs(args),
  };
  addLogEntry(logEntry);
}

Dependencies (Outgoing)

graph LR emit["emit"] shouldLog["shouldLog"] formatArgs["formatArgs"] addLogEntry["addLogEntry"] emit -->|calls| shouldLog emit -->|calls| formatArgs emit -->|calls| addLogEntry style emit fill:#dbeafe,stroke:#2563eb,stroke-width:2px click emit "131b8d3f5dc1f207.html" click shouldLog "49f7fde9c48523cd.html" click formatArgs "7295db40a071fe9d.html" click addLogEntry "b5eb9ecc61a3eb82.html"
TargetType
shouldLog calls
formatArgs calls
addLogEntry calls

Impact (Incoming)

graph LR emit["emit"] debug["debug"] info["info"] warn["warn"] error["error"] groupCollapsed["groupCollapsed"] group["group"] debug -->|calls| emit info -->|calls| emit warn -->|calls| emit error -->|calls| emit groupCollapsed -->|calls| emit group -->|calls| emit style emit fill:#dbeafe,stroke:#2563eb,stroke-width:2px click emit "131b8d3f5dc1f207.html" click debug "6a1e70b4f3a8c4bb.html" click info "6f3556cbea8826f9.html" click warn "9f8badd5bb39f102.html" click error "4c0bc34e62d3e8bf.html" click groupCollapsed "4ab6085ac424455a.html" click group "07d14529b23f8e28.html"
SourceType
debug calls
info calls
warn calls
error calls
groupCollapsed calls
group calls