NOTE: In Beta.
Fully configurable structured messaging and logging tool wrapping Winston. Recommended to be used in conjunction with config-core.
Quickly get up and running with structured logging/messaging without being too opinionated.
We highly suggest using this library in conjunction with config-core.
Checkout the typescript examples.
import StructuredMessaging from 'structured-messaging';
let currentMessage = 0;
const logger = new StructuredMessaging(
// use any winston parameters
// see (https://github.com/winstonjs/winston#creating-your-own-logger)
{
level: 'info',
// configure transports
transport: [
{ type: 'console' },
{
type: 'file',
// use any winston transport options for the given transport
options: { filename: 'error_01.log', level: 'error' },
},
],
sharedData: {
count: () => {
currentMessage += 1;
return currentMessage;
},
},
},
).loggers();
logger.info('This is log message number %{count}.');
logger.info('This is log message number %{count}.');
// setup the logger