1.0.9 • Published 1 month ago

@storyous/logger v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

logger

Usage

import { initLogger } from '@storyous/logger';

const config = {
    env: process.env.NODE_ENV,
    logging: {
        console: {
            colorize: true,
            
            // Use for localhost development only, it will output nicely readable logs
            // and if error appears the stack will be clickable in webstorm
            prettyOutput: true,
        },
        loggly: {
            silent: true,
            token: process.env.LOGGLY_TOKEN || '',
            subdomain: 'storyous',
            tags: ['serviceName', process.env.NODE_ENV],
            json: true
        },
        sentry: {
            dsn: process.env.SENTRY_DSN || '',
            level: 'error',
            silent: true
        }
    }
}

const logger = initLogger(config.env, config.logging);

// define new logger for specific module
const logModule = logger.module('extraLogger');

export default logger;