hamon
v1.0.5
Published
The library for publishing severity info to HAMON
Downloads
1
Readme
Example
let util = require( 'util' );
let assert = require( 'assert' );
let hamon = ( require( './hamon' ) ).init({
// url - is required option
url : 'http://127.0.0.1:3030',
// componentName - is required option
componentName : 'test-name',
// componentVersion - is required option
componentVersion : '0.0.1',
// formatMessage - is optional option
formatMessage : ( ...messages ) => {
return util.format( ...messages );
}
});
let hamon2 = require( './hamon' );
assert.equal( hamon, hamon2 );
process.stdin.pipe( hamon );
hamon.pipe( process.stdout );
hamon.info({
foo : "bar",
bar : 42
});
assert.equal( hamon.log, hamon.info );
hamon.error( "err", "msg" );
#Short example
let hamon = ( require( './hamon' ) ).init({
url : 'http://127.0.0.1:3030',
componentName : 'test-name',
componentVersion : '0.0.1'
});
hamon.info( 'text' );