1.0.6 • Published 2 years ago

node-jotter v1.0.6

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

node-jotter

Installation

Using npm:

$ npm i --save node-jotter

In Node.js:

Initialize the logger instance with LoggerConfiguration. This initializes instance of logger which prints logs in a file: local.log

// Setup LoggerConfiguration
const loggerConfiguration: LoggerConfiguration = {
  filename: 'local.log',
  environment: Environment.development,
  serviceName: 'example',
  level: 'debug'
};
// Initialize the Logger with the configuration
const logger = new Logger(loggerConfiguration);

Printing Error messages

logger.info(
    'HEllo this is a test', // Message
    { test: 'Hi' } // Meta data
);

logger.fatal(
  'Table not found', // Error message
  new Error(
      'Missing table User'
      ), // Error instance
  { source: 'database' } // Meta data
);


logger.error(
    'Low balance',  // Error message
    new Error(
        'Balance calculator crashed'
        ),     // Error instance
    { 
        source: 'Balance table',
        userName: 'ElA'
    }         // Meta data
);
1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago