@cladikzone/logger-module

A logger module.

Usage no npm install needed!

<script type="module">
  import cladikzoneLoggerModule from 'https://cdn.skypack.dev/@cladikzone/logger-module';
</script>

README

Logger Module

This is a common logger module which supports Aws cloudwatch and winston log features.

Usage

import * as oxStreet from '@cladikzone/logger-module';

const factory = new oxStreet.LoggerFactory({
    aws: {
        accessKeyId: '...',
        secretAccessKey: '...',
        region: '...',
    },
    transports: [
        new oxStreet.transports.Console(),
        new oxStreet.transports.File({ filename: './logs/error.log', level: 'error' }),
        new oxStreet.transports.File({ filename: './logs/audit.log', level: 'audit' }),
    ],
});

const audit = factory.create({
    logGroupName: 'PRODUCT_SERVICE', // Required
    logStreamName: 'stream-one',
    level: 'audit', // Required
    streamAsLevel: true,  // If this is true, your 'logStreamName' parameter will be ignored and the 'level' will be used as the stream name.
});

audit('Something');
audit('Something very critical');
...