Skip to content

digitalbunch/tdb-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation:

$ npm install @thedigitalbunch/logger

Importing:

import { Logger } from '@thedigitalbunch/logger';

Usage:

In a development environment, use environmental variable LOGGER=dev.

const logger = new Logger('TestService');

logger.log('Hello World!');

You can also change the logger options, including the format:

import { developmentConsoleColorFormat, Logger } from '@thedigitalbunch/logger';

Logger.setOptions({ format: developmentConsoleColorFormat() });

You can automatically capture errors with Sentry, by using:

Logger.useSentry({ levels: ['error', 'warning'] });