Skip to content
View as Markdown
View as Markdown

@salesforce/b2c-tooling-sdk / operations/logs / parseLogEntry

Function: parseLogEntry()

parseLogEntry(firstLine, file, fullMessage, pathNormalizer?): LogEntry

Defined in: packages/b2c-tooling-sdk/src/operations/logs/tail.ts:60

Parses the first line of a log entry to extract timestamp, level, and message.

Expected format: [timestamp GMT] LEVEL context - message Example: [2025-01-25 10:30:45.123 GMT] ERROR PipelineCallServlet|... - Error message

The message field will contain:

  • The content portion from the first line (after LEVEL)
  • Plus any continuation lines (stack traces, etc.)

If the standard B2C log format is not matched, returns an unparsed entry with only the file, message, and raw fields. The timestamp and level fields will be undefined in this case, but the raw log line is preserved for debugging or recovery purposes.

Parameters

firstLine

string

First line of the log entry

file

string

File name the entry came from

fullMessage

string

Complete raw message including all lines

pathNormalizer?

(msg) => string

Optional function to normalize paths in the message

Returns

LogEntry

Parsed log entry; fields timestamp and level may be undefined if format doesn't match

Released under the Apache-2.0 License.