Module

utils/logger

Logging helper

we use the winston library to simplify logging see: https://github.com/winstonjs/winston for API docs

View Source utils/logger.js, line 1

Members

# inner isLoggerSetupComplete

Flag for whether logger setup has completed (following config module init)

View Source utils/logger.js, line 263

# inner constant PIIAttributes

List of Personally Identifiable Information (PII) that we want to filter from the logs.

View Source utils/logger.js, line 67

Methods

# inner log(message, options) → {winston.log|null}

Log a message to console in accordance with the SDK configuration

NOTE: If an Error object is passed as the message, it will log both the error's message and stack trace.

Parameters:
Name Type Description
message string

Log message

options object

Options object

level string

Log level

meta object

Optional log metadata

data object

Optional log data to be sanitized and replace log placeholders

View Source utils/logger.js, line 331

Returns a log message, along with optional metadata (if the module:config option verbose is true).

winston.log | null

# inner mergeMessageAndData(message, data) → {string}

Takes a message string and a data object, returning a string with redacted and filtered data.

Parameters:
Name Type Description
message string

The string template with placeholders.

data object

Object containing unfiltered data to be included in the log message.

View Source utils/logger.js, line 306

log string with filtered values.

string

# inner setLogFilePath(path)

Sets the path for the log file and enable file logging.

NOTE: Runs on module initialization.

Parameters:
Name Type Description
path string

Log file path

View Source utils/logger.js, line 254