1.1.2 • Published 5 years ago

tagged-console-target v1.1.2

Weekly downloads
6
License
BSD
Repository
bitbucket
Last release
5 years ago

TaggedConsoleTarget

A log target for Winston that expects tagged log messages and writes them with lots of colors to the console or a given output stream.

This module is designed to work together with TaggedLogger.

Install

npm install tagged-console-target

Example

For this example you need to npm install winston tagged-console-target.

var winston = require('winston');
var TaggedConsoleTarget = require('tagged-console-target');

var logger = new (winston.Logger)({
	transports: [
		new TaggedConsoleTarget()
	]
});

logger.info("Log message 1", {tags: ['module a']});
logger.info("Log message 2", {tags: ['module a', 'submodule a1']});
logger.info("Log message 3", {tags: ['module b']});

Example output:

16:46:06.004 2013-04-17 Wednesday
16:46:06.007 [module a] Log message 1
16:46:06.008 [module a, submodule a1] Log message 2
16:46:06.008 [module b] Log message 3

Except the output is in glorious color!

Options

TaggedConsoleTarget accepts an object with options for the constructor. The accepted options are:

  • target: The target output stream. Defaults to process.stdout
  • level: The minimum level of log messages to output to this logger, for example "info". Keep this unset to allow all messages that are accepted by the logger object
  • handleExceptions: Set to true to intercept unhandled exceptions and output them to this log target
  • exceptionsLevel: The log level at which to log exceptions. Defaults to error
  • humanReadableUnhandledException: Format exception log output in a more readable fashion
1.1.2

5 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

13 years ago

1.0.4

13 years ago

1.0.3

13 years ago

1.0.2

13 years ago

1.0.1

13 years ago

1.0.0

13 years ago