Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webgap/logger

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webgap/logger

WebGAP Logger module.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

WebGAP Logger

Build Status Test Coverage Code Climate Dependency Status

NPM version NPM downloads

README

This is the base logger module for WebGAP. It hijacks' all the console log methods and redirects them to winston log file.

Dependencies

Handles logging using winston. Loads default configuration using @webgap/configuration

API

Installation

npm install @webgap/logger --save

Usage

var logger = require('@webgap/logger').init();
...
// or overriding with options
...
var options = {
  applicationLogPath: '/tmp/application.log',
  applicationExceptionsLogPath: '/tmp/exceptions.log',
  level: 'debug'
};
var logger = require('@webgap/logger').init(options);
...
logger.info('info message');
logger.debug('debug message');
logger.error('error message');
logger.warn('warning message');
...
// it hijacks' all the console functions and adds a debug one
// this allows a consistent logging with console in every module
// and ensures all output ends up in the log files
console.log('info message');
console.info('info message');
console.error('error message');
console.warn('warning message');
console.debug('debug message');

Options

The object 'options' is optional and can be passed into the 'Logger' class:

var options = {
    applicationLogPath: '/tmp/application.log', //absolute path and file name
    applicationExceptionsLogPath: '/tmp/exceptions.log', //absolute path and file name
    level: 'debug' // one of ["debug", "info", "warn", "error"],
    overrideConsole: false // defaults to true
};
var logger = require('@webgap/logger').init(options);

If no 'options' is provided, the module will try to load default configurations from @webgap/configuration module.

Default configurations for this module are as follows:

GENERAL.LOG.FILE - Defaults to '/tmp/application.log'
GENERAL.LOG.EXCEPTIONS_FILE - Defaults to '/tmp/application-exceptions.log'
GENERAL.LOG.LEVEL - Defaults to 'info'

Please check @webgap/configuration for documentation.

License

Apache License, Version 2.0

Keywords

FAQs

Package last updated on 10 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc