Module: jsdoc/util/logger

Logging tools for JSDoc. Log messages are printed to the console based on the current logging level. By default, messages at level `module:jsdoc/util/logger.LEVELS.ERROR` or above are logged; all other messages are ignored. In addition, the module object emits an event whenever a logger method is called, regardless of the current logging level. The event's name is the string `logger:` followed by the logger's name (for example, `logger:error`). The event handler receives an array of arguments that were passed to the logger method. Each logger method accepts a `message` parameter that may contain zero or more placeholders. Each placeholder is replaced by the corresponding argument following the message. If the placeholder does not have a corresponding argument, the placeholder is not replaced. The following placeholders are supported: + `%s`: String. + `%d`: Number. + `%j`: JSON.
Source:
See:
Example
var logger = require('jsdoc/util/logger');

var data = {
  foo: 'bar'
};
var name = 'baz';

logger.warn('%j %s', data, name);  // prints '{"foo":"bar"} baz'

Extends

  • module:events.EventEmitter

Members

(static) debug

Log a message at log level module:jsdoc/util/logger.LEVELS.DEBUG.
Source:

(static) error

Log a message at log level module:jsdoc/util/logger.LEVELS.ERROR.
Source:

(static) fatal

Log a message at log level module:jsdoc/util/logger.LEVELS.FATAL.
Source:

(static) info

Log a message at log level module:jsdoc/util/logger.LEVELS.INFO.
Source:

(static) LEVELS :number

Logging levels for the JSDoc logger. The default logging level is module:jsdoc/util/logger.LEVELS.ERROR.
Type:
  • number
Properties:
Name Type Description
SILENT number Do not log any messages.
FATAL number Log fatal errors that prevent JSDoc from running.
ERROR number Log all errors, including errors from which JSDoc can recover.
WARN number Log the following messages: + Warnings + Errors
INFO number Log the following messages: + Informational messages + Warnings + Errors
DEBUG number Log the following messages: + Debugging messages + Informational messages + Warnings + Errors
VERBOSE number Log all messages.
Source:

(static) printDebug

Print a string at log level module:jsdoc/util/logger.LEVELS.DEBUG. The string is not terminated by a newline.
Source:

(static) printInfo

Print a string at log level module:jsdoc/util/logger.LEVELS.INFO. The string is not terminated by a newline.
Source:

(static) printVerbose

Print a string at log level module:jsdoc/util/logger.LEVELS.VERBOSE. The string is not terminated by a newline.
Source:

(static) verbose

Log a message at log level module:jsdoc/util/logger.LEVELS.VERBOSE.
Source:

(static) warn

Log a message at log level module:jsdoc/util/logger.LEVELS.WARN.
Source:

Methods

(static) getLevel() → {module:jsdoc/util/logger.LEVELS}

Get the current log level.
Source:
Returns:
The current log level.
Type
module:jsdoc/util/logger.LEVELS

(static) setLevel(level)

Set the log level.
Parameters:
Name Type Description
level module:jsdoc/util/logger.LEVELS The log level to use.
Source: