Constructs a new Logger.
A set of LoggerOptions or name to use with the default options.
Throws SfError{ name: 'RedundantRootLoggerError' } More than one attempt is made to construct the root
Logger.
Static ReadonlyDEFAULT_The default LoggerLevel when constructing new Logger instances.
Static ReadonlyLEVEL_A list of all lower case LoggerLevel names.
See LoggerLevel
Static ReadonlyROOT_The name of the root sfdx Logger.
Add a field to all log lines for this logger. For convenience this object is returned.
The name of the field to add.
The value of the field to be logged.
Create a child logger, typically to add a few log record fields. For convenience this object is returned.
The name of the child logger that is emitted w/ log line. Will be prefixed with the parent logger name and :
Additional fields included in all log lines for the child logger.
Logs at debug level with filtering applied. For convenience this object is returned.
Any number of arguments to be logged.
Logs at debug level with filtering applied.
A callback that returns on array objects to be logged.
Logs at error level with filtering applied. For convenience this object is returned.
Any number of arguments to be logged.
Logs at fatal level with filtering applied. For convenience this object is returned.
Any number of arguments to be logged.
Gets an array of log line objects. Each element is an object that corresponds to a log line.
Gets the current level of this logger.
Gets the name of this logger.
get the bare (pino) logger instead of using the class hierarchy
Logs at info level with filtering applied. For convenience this object is returned.
Any number of arguments to be logged.
Reads a text blob of all the log lines contained in memory or the log file.
Set the logging level of all streams for this logger. If a specific level is not provided, this method will
attempt to read it from the environment variable SFDX_LOG_LEVEL, and if not found,
Logger.DEFAULT_LOG_LEVEL will be used instead. For convenience this object is returned.
Optionallevel: number
The logger level.
Throws SfError{ name: 'UnrecognizedLoggerLevelNameError' } A value of level read from SFDX_LOG_LEVEL
was invalid.
// Sets the level from the environment or default value
logger.setLevel()
// Set the level from the INFO enum
logger.setLevel(LoggerLevel.INFO)
// Sets the level case-insensitively from a string value
logger.setLevel(Logger.getLevelByName('info'))
Compares the requested log level with the current log level. Returns true if the requested log level is greater than or equal to the current log level.
The requested log level to compare against the currently set log level.
Logs at trace level with filtering applied. For convenience this object is returned.
Any number of arguments to be logged.
Logs at warn level with filtering applied. For convenience this object is returned.
Any number of arguments to be logged.
StaticchildStaticchildStaticgetGets a numeric LoggerLevel value by string name.
The level name to convert to a LoggerLevel enum value.
Throws SfError{ name: 'UnrecognizedLoggerLevelNameError' } The level name was not case-insensitively recognized as a valid LoggerLevel value.
Staticgetget the bare (pino) logger instead of using the class hierarchy
StaticgetGets the root logger. It's a singleton
StaticrootGets the root logger. It's a singleton See also getRawLogger if you don't need the root logger
A logging abstraction powered by Pino that provides both a default logger configuration that will log to the default path, and a way to create custom loggers based on the same foundation.
See https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_log_messages.htm