Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

JS7 - JavaScript Jobs can use the JS7 Logger like this:

Code Block
languagejs
titleExample for implementation of JS7Job with JavaScript
linenumberstrue
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
    }
}

...

Basically the JavaScript methods  print(), Consoleconsole.log(), Consoleconsole.info(), Consoleconsole.warn() etc. methods cannot be used as they directly address the stdout channel. As a result use of the methods writes output to the JS7 Agent's stdout channel and to its ./logs/watchdog.log file.

...

The Script Include can be referenced from a job using the syntax: //!include <name-of-script-include>

Subsequently As a result jobs can use the JavaScript Console Logger as usually:

Code Block
languagejs
titleExample for implementation of JS7Job with JavaScript
linenumberstrue
class JS7Job extends js7.Job {

	processOrder(js7Step) {
//!include JavaScript-Logging
        print('.. printing some information');
        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
    }
}

...