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

arklogger

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arklogger

Set of several presets for bunyan logger

  • 2.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Logger

Framework logger for ark team purposes. Based on bunyan library.

Features:

  • lightweight and flexible
  • support logging to: console, file, logstash and any stream
  • all features of bunyan

Warning:

If stream logstash is used with pubsub queue (cfg.pubsub set to true) - app will not exit correctly (socket is still open). You should close socket manually (logstashstream.redis.end()): https://github.com/mranney/node_redis#clientend

Usage:

#####First, load library in your app

var Logger = require('logger');

#####Second, init logging function with one of this methods: 1) Init by config

// all fields are optional except "name" and "level"
var cfg = {
    name: 'my app',
    console: {
        level: 'info',
        color: true,
        timestamp: 'HH:mm:ss '
    },
    logstash: {
        level: 'info',
        key: 'logstash',
        pubsub: false,
        host: '127.0.0.1',
        port: 6379,
        db: 0
    },
    file: {
        level: 'error',
        path: 'error.log'
    }
};
var log = new Logger(cfg);
log.error('i will appear only in file')

2) Create streams by yourself

var logger = new Logger('my app');

logger.appendStream({
    stream: new Logger.stream.logstash(),
    type: 'raw',
    level: 'info'
});
logger.appendStream({
  stream: new Logger.stream.console(),
  type: 'raw',
  level: 'info'
});

// if no appendStream called - will be created logger to console only
var log = logger.createLogger();
log.info('hello')

3) Pass streams on init in array

var log = new LoggerClass('my app', [{
  stream: process.stdout,
  level: 'info'
}]);
log.error('im usable');

4) Load preset

// will load config from presets/dc-fremont.json
var log = new Logger('my app', 'dc-fremont');
log.error('im usable');

What else:

Logger supports all bunyan features: passing custom fields, child logging, serializers, logging caugth JS expeptions and http responces, working with streams etc. Please visit bunyan documentation for more.

FAQs

Package last updated on 04 Jul 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