1.0.10 • Published 5 years ago

maxmilhas-logger v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Logger

This is an abstraction for winston logger, with this package we can just inform the transporter and it will provide a winston instance configured

Install with:

npm install @maxmilhas/logger

Usage

Local

    import { LoggerFactory } from '@maxmilhas/logger';
    /** logger is an instance of winston with local console as a transporter **/
    const logger = LoggerFactory.create('console', {
      level: 'verbose',
    });

Firehose

    import { LoggerFactory } from '@maxmilhas/logger';
    /** logger is an instance of winston with firehose as a transporter **/
    const logger = LoggerFactory.create('console', {
      level: 'debug',
      name: 'container-name',
      region: 'us-east-1',
      accessKeyId: 'AWS_KEY',
      secretAccessKey: 'AWS_SECRET'
    });

Redis

    import { LoggerFactory } from '@maxmilhas/logger';
    /** logger is an instance of winston with redis as a transporter **/
    const logger = LoggerFactory.create('redis', {
      level: 'verbose',
      container: 'container-name',
      environment: 'homologation',
      host: 'redis-host.com.br',
      port: '6379'
    });