This example references the main entry point of Woodman directly in the source code using require.js. It does not use a compiled version of Woodman in particular. This is typically useful for debugging purpose when authoring appenders or layouts.
<script type="text/javascript"
src="../../node_modules/requirejs/require.js"
data-main="source.js">
</script>
The source.js
file contains the main call to
require
and logs a few events to the console:
require(['../../lib/woodman'], function (woodman) {
var config = { ... };
woodman.load(config, function (err) {
if (err) throw err;
var logger = woodman.getLogger('browser.main');
logger.log('Welcome to Woodman');
logger.info('This is an info message');
logger.warn('This is a warning');
logger.error('This is an error');
});
});
Open your console to see the result!