gorila-logger
v1.3.2
Published
`gorila-logger` works as a wrapper for the [winston](https://github.com/winstonjs/winston) logger.
Downloads
73
Readme
Gorila Logger
gorila-logger
works as a wrapper for the winston logger.
If you need to use the IGorilaLogger
interface or you want to import the logger more like an es6 package, import from "gorila-logger/es6"
import * as logger from 'gorila-logger';
// or use
// import { logger } from 'gorila-logger/es6';
logger.setFileLogging({
dir: 'logs', //optional -> default = './logs'
filename: 'advisor_log', //optional -> default = 'log'
});
logger.hasFileLogging(); // true
logger.setSlackHook({
username: 'AdvisorLogger', //optional -> default = Logger
channel: 'gorila-alert-dev', //required
hook: 'https://hooks.slack.com/services/***/***/***', //required
iconEmoji: ':gorila:' // optional -> default = ':no_entry:'
});
logger.hasSlackHook(); // true
logger.info('Logging into file...');
logger.error('Error message sent to Slack!');
Both setSlackHook
and setFileLogging
override previous configurations. For example, if you use setSlackHook
more than once, only the configuration of the last call will be valid.