3.1.1 • Published 3 years ago

coa-node-logging v3.1.1

Weekly downloads
37
License
MIT
Repository
github
Last release
3 years ago

coa-node-logging

Common interface to logging for COA node scripts

Logging Standards

City of Asheville node applications should follow the logging guidelines from The Open Web Application Security Project (OWASP).

Usage

  const logFile = 'path-to-log-file';
  const name = 'test-logger'; 
  const Logger = require('coa-node-logging');
  const logger = new Logger(name, logFile);
  const testObject = {
    field1: 123,
    field2: "A string",
  };
  logger.error('This is a message');
  logger.info('This is a message with an object', { name1: 'value1', name2: 2 });
  logger.warn('This is a warning message');

If logFile is null, output will only go to stdout. By default output is always also be logged to the console. To suppress this, override the default value of the third parameter, logToConsole:

  const logger = new Logger(name, logFile, false);

Note that setting logFile to null when the third parameter is also false means that no logging will be done.

Installation

Install with

  npm install --save coa-node-logging
3.1.1

3 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago