Logging helper
we use the winston library to simplify logging see: https://github.com/winstonjs/winston for API docs
- Copyright:
- 2015–2020 RewardOps Inc.
Members
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 |
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. |
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 |