For AI agents: the complete documentation index is available at /en/llms.txt, the full documentation bundle is available at /en/llms-full.txt, and this page is available as Markdown at /en/reference/sdk/logs/functions/formatLog.md.
  • English
  • Function: formatLog()

    function formatLog(entry: LogEntry, opts?: FormatOptions): string;

    Defined in: logs/format.ts:291

    格式化日志条目供控制台或 REPL 界面展示。 输出格式:<localTime> <paddedSource> <levelTag> <text>。

    Parameters

    ParameterTypeDescription
    entryLogEntry日志条目结构。
    optsFormatOptions格式化选项(可指定是否开启彩色和来源列对齐宽度)。

    Returns

    string

    用于终端显示的格式化字符串。