console-logtron

1.0.1 • Public • Published

console-logtron

A console logger with a logtron interface.

Example

This logger is designed for scripts and one off programs. It has a logtron compatible interface and writes to STDOUT.

var ConsoleLogtron = require("console-logtron");
 
var logger = ConsoleLogtron('mylibrary');
 
logger.debug('some fixed string', { some: 'meta object' });
logger.info('some fixed string', { some: 'meta object' });
logger.warn('some fixed string', { some: 'meta object' });
logger.error('some fixed string', { some: 'meta object' });

It writes all logs to stdout using new line JSON

Alternatives

Warning: This a logger for scripts! Not a default logger.

If you want to add a default logger to your dependencies then I strongly recommend you use null-logtron

Alternatively, if you want a logger meant for tests then I strongly recommend that you use debug-logtron

Motivation

You have a script that you want to run once off or on a cron.

You do not want to have to deal with a heavy weight logger, you just want JSON on stdout and redirect it to a file.

This is where console-logtron comes in, it's like console.log but it will write new line JSON to stdout so you can use jq to process the log data.

Docs

// TODO. State what the module does.

Installation

npm install console-logtron

Tests

npm test

Contributors

  • Raynos

MIT Licensed

Readme

Keywords

none

Package Sidebar

Install

npm i console-logtron

Weekly Downloads

2

Version

1.0.1

License

none

Last publish

Collaborators

  • raynos