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). |
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. |
error(…message)
Log an error message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
* |
<repeatable> |
Message arguments. |
info(…message)
Log an info message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
* |
<repeatable> |
Message arguments. |
isDebugEnabled() → {boolean}
Is the Level.DEBUG logging level enabled for this logger instance.
Shorthand for logger.isEnabled(Level.DEBUG)
.
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. |
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)
.
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)
.
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)
.
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. |
warn(…message)
Log a warn message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
* |
<repeatable> |
Message arguments. |