Logging with the JS7 Logger
JS7 - JavaScript Jobs can use the JS7 Logger like this:
Example for implementation of JS7Job with JavaScript
class JS7Job extends js7.Job { processOrder(js7Step) { js7Step.getLogger().info('logging some information'); js7Step.getLogger().warn('.. logging some warning'); js7Step.getLogger().error('.. logging some error'); js7Step.getLogger().debug('.. logging some debug output'); // do some stuff } }
Explanation:
- The
js7Step.getLogger()
object is provided that offers related methods for logging. - By default output of
info()
,warn()
anddebug()
methods is written to the stdout channel, output byerror()
is written to stderr.- The argument
log_level
can be used for a job to specify the log level:log_level = info
: default, no debug output enabled.log_level = debug
: includes debug output
- For details see JS7 - JITL Common Variables.
- The argument
- For details see JS7 - Job API.
Logging with the JavaScript Console Logger
JavaScript Jobs can use the Console Logger like this:
Example for implementation of JS7Job with JavaScript
class JS7Job extends js7.Job { processOrder(js7Step) { console.info('.. logging some information'); console.log('.. logging some information'); console.warn('.. logging some warning'); console.error('.. logging some error'); console.debug('.. logging some debug output'); // do some stuff } }
Further Resources
Overview
Content Tools