logger/LogData~LogData(logType, logObject)

Show:

new LogData(logType, logObject)

Consolidates logging data into a single flattened object (flatLogObject) and exposes various methods that can be used by backends to generate message strings (e.g., stack trace).

Consolidates logging data into a single flattened object (flatLogObject) and exposes various methods that can be used by backends to generate message strings (e.g., stack trace).

Parameters:
Name Type Description
logType string

Type of log being generated.

logObject Object

Data being logged.

Source:

Methods

_flatten(o, topLevel) → {Object|string|string|string}

Returns a flattened object with an arbitrary number of fields, including "msg" (combining all "msg" fields and strings from underlying objects) and "stack" (a stack trace, if any).

Returns a flattened object with an arbitrary number of fields, including "msg" (combining all "msg" fields and strings from underlying objects) and "stack" (a stack trace, if any).

Parameters:
Name Type Description
o Object

Object to flatten.

topLevel string

Separate top-level from recursive calls.

Source:
Returns:
  • Flattened Object.

    Type
    Object
  • [return.msg] All "msg" fields, combined with spaces.

    Type
    string
  • [return.longMsg] All "msg" fields, combined with newlines.

    Type
    string
  • [return.stack] A stack trace (if any).

    Type
    string

flatLogObject()

Flattens the logObject array into a single object for access by backends.

Flattens the logObject array into a single object for access by backends.

Source:

fullMsg()

Generate a full message string consisting of a message and stack trace.

Generate a full message string consisting of a message and stack trace.

Source:

msg()

Generate a message string that combines all of the logObject's message fields (if an originally an object) or strings (if originally an array of strings).

Generate a message string that combines all of the logObject's message fields (if an originally an object) or strings (if originally an array of strings).

Source:

stack()

Generates a message string with a stack trace.

Generates a message string with a stack trace. Uses the flattened logObject's stack trace if it exists; otherwise, creates a new stack trace.

Source: