Class: Logger

Logger

new Logger(category)

Create a new Logger instance for the specified category.
Parameters:
Name Type Description
category string The category name. Use dot separated naming convention to create a category hierarchy (ala Log4J).
Source:
Example
const logging = require('@jenkins-cd/logging');
const logger = logging.logger('org.jenkinsci.sse');

if (logger.isDebugEnabled()) {
    logger.debug('Log a message for x and y values: ', x , y);
}

Methods

debug(…message)

Log a debug message.
Parameters:
Name Type Attributes Description
message * <repeatable>
Message arguments.
Source:

error(…message)

Log an error message.
Parameters:
Name Type Attributes Description
message * <repeatable>
Message arguments.
Source:

info(…message)

Log an info message.
Parameters:
Name Type Attributes Description
message * <repeatable>
Message arguments.
Source:

isDebugEnabled() → {boolean}

Is the Level.DEBUG logging level enabled for this logger instance.

Shorthand for logger.isEnabled(Level.DEBUG).

Source:
Returns:
True if the level is enabled, otherwiser false.
Type
boolean
Example
if (logger.isDebugEnabled()) {
    logger.debug('Log a message for x and y values: ', x , y);
}

isEnabled(level) → {boolean}

Is the specific logging level enabled for this logger instance.
Parameters:
Name Type Description
level Level The logging level.
Source:
Returns:
True if the level is enabled, otherwiser false.
Type
boolean
Example
if (logger.isEnabled(Level.DEBUG)) {
    logger.debug('Log a message for x and y values: ', x , y);
}

isInfoEnabled() → {boolean}

Is the Level.INFO logging level enabled for this logger instance.

Shorthand for logger.isEnabled(Level.INFO).

Source:
Returns:
True if the level is enabled, otherwiser false.
Type
boolean
Example
if (logger.isInfoEnabled()) {
    logger.info('Log a message for x and y values: ', x , y);
}

isLogEnabled() → {boolean}

Is the Level.LOG logging level enabled for this logger instance.

Shorthand for logger.isEnabled(Level.LOG).

Source:
Returns:
True if the level is enabled, otherwiser false.
Type
boolean
Example
if (logger.isLogEnabled()) {
    logger.log('Log a message for x and y values: ', x , y);
}

isWarnEnabled() → {boolean}

Is the Level.WARN logging level enabled for this logger instance.

Shorthand for logger.isEnabled(Level.WARN).

Source:
Returns:
True if the level is enabled, otherwiser false.
Type
boolean
Example
if (logger.isWarnEnabled()) {
    logger.warn('Log a message for x and y values: ', x , y);
}

log(…message)

Log an "log" level message.
Parameters:
Name Type Attributes Description
message * <repeatable>
Message arguments.
Source:

warn(…message)

Log a warn message.
Parameters:
Name Type Attributes Description
message * <repeatable>
Message arguments.
Source: