4.2.1 • Published 3 years ago

@enigmatis/polaris-logs v4.2.1

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

polaris-logs

Build Status npm version

A node.js library that helps you create and use loggers according to a certain standard.

LoggerConfiguration

Through this interface you should set the following configuration to the PolarisLogger:

  • loggerLevel (string) - The level the logger is listening on, can be one of the following levels: fatal / error / warn / info / trace / debug
  • logstashHost (string)
  • logstashPort (number)
  • writeToConsole (boolean - optional) - Determines if the logger should write the logs to the console.
  • writeFullMessageToConsole (boolean - optional) - If you do decide to write logs to console, only the timestamp accompanied by the log level and message will be written, in order to see the whole log, which includes the properties that would be sent to the logstash, set this property to true.

ApplicationLogProperties

This interface represent the application configurable log properties.

Those properties are:

  • systemId
  • systemName
  • repositoryVersion
  • environment
  • component

PolarisLogProperties

This interface represent the log properties that will be logged through the PolarisLogger.

PolarisLogger

This class interacts with the actual winston logger and responsible for logging the properties that was provided to him.

Example

import { ApplicationLogProperties, PolarisLogger, LoggerConfiguration } from '@enigmatis/polaris-logs';

const appProps: ApplicationLogProperties = {
    id: 'p0laris-l0gs',
    name: 'polaris-logs',
    repositoryVersion: 'v1',
    environment: 'environment',
    component: 'component',
};
const logConf: LoggerConfiguration = {
    loggerLevel: 'trace',
    logstashHost: '127.0.0.1',
    logstashPort: 3000,
    writeToConsole: true,
    writeFullMessageToConsole: true,
};

const logger = new PolarisLogger(appProps, logConf);

logger.fatal('hello world!');
logger.error('hello world!');
logger.warn('hello world!');
logger.info('hello world!');
logger.trace('hello world!');
logger.debug('hello world!');

For any additional help and requests, feel free to contact us :smile:

5.0.0-beta.6

3 years ago

5.0.0-beta.5

3 years ago

5.0.0-beta.4

3 years ago

5.0.0-beta.3

3 years ago

5.0.0-beta.2

3 years ago

5.0.0-beta.1

3 years ago

4.2.1

3 years ago

5.1.0

4 years ago

4.2.0

4 years ago

5.0.0

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.8.2

4 years ago

2.8.1

4 years ago

2.8.0

4 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.6.4

4 years ago

2.6.3

4 years ago

2.6.2

4 years ago

2.6.1

4 years ago

2.6.0

4 years ago

2.5.5

4 years ago

2.5.4

5 years ago

2.5.3

5 years ago

2.5.2

5 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.3

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago