@map-colonies/mc-logger
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Map-Colonies logger

build on top of winston logger

Install

$ npm install --save @map-colonies/mc-logger

Usage

On node servers:

const { MCLogger } = require("@map-colonies/mc-logger");
const service = require("./package.json");

const config = {
    level: 'info',
    log2file: FileTransportOptions
}

const logger = new MCLogger(config, service);

logger.info('logger is logging');

On client side:

const { MCLogger } = require("@map-colonies/mc-logger");
const service = require("./package.json");

const config = {
    level:'info',
    log2httpServer: {
        host: '<hostname>',
        port: '<port>',
        path: '<path_on_server>',
    }
}

const logger = new MCLogger(config, service);

logger.info('logger is logging');

The config 'log2httpServer' option has the following fields:

  • host: required
  • port: optional, default is 80 or 443
  • path: optional, default is '/'
  • auth: optional, default is None
  • ssl: optional, default is false

Notes

  • log2file is not supported on client-side.
  • log2console is set as default if no other option is present.

Readme

Keywords

none

Package Sidebar

Install

npm i @map-colonies/mc-logger

Weekly Downloads

0

Version

2.0.2

License

ISC

Unpacked Size

11.3 kB

Total Files

8

Last publish

Collaborators

  • mapcolonies
  • syncush
  • asaf.masa
  • schnitz
  • shahar_s
  • konchashlomicl
  • shimoncohen
  • alebinson
  • rannyeli
  • tropface
  • glata95