New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sbis3-cloud-logger

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sbis3-cloud-logger

Simple logger for SBIS3 Cloud

  • 0.3.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

SBIS3 Cloud Logger

Install

npm install sbis3-cloud-logger --save

Use

Module exports a singleton object (only one instance per working process).


var logger = require('sbis3-cloud-logger');

Before sending logs, it must be configured using init() method.

Pass options object to init() to set logger options.


// If both url and cloud is set - priority to cloud
// You MUST specify one of them
logger.init({
    url: 'https://some.host.tld/path/to/backend', // Full logging backend URL.
    cloud: 'online.sbis.ru', // Cloud hostname.
    logThreshold: 500, // how many log records to keep before sending. Default: 100
    queueCheckTime: 5000, // how often to check log buffer. Default: 1000
    appName: 'My Awesome Service', // Application name (appears in log). Default: 'Node'
    sendTimeout: 1000, // If sending is taking this more time, abort it
    appPort: 5555 // Application port (appears in log). Default: 0
});

After first call to init() is made, all further call will be completely ignored.

If cloud parameter is not set while doing init(), exception is thrown.

When done with initialization, use log() method.


logger.log('Bam! Exception!');
logger.log('Loading resources...', 'INFO');
logger.log('Watch out! Memory is almost full!', 'WARNING');

Instead of passing a text message as a first parameter, one can pass object with fields:

  • msg
  • method
  • extip
  • intip
logger.log({
    msg: 'Log message',
    method: 'Object.Method'
});

If init() is not done, all calls to log() is useless and completely ignored.

If you need to forcibly flush logs, use flush() method (since 0.2.0 it flushes logs immediately, not on a next timer tick as of 0.1.0).

To terminate logger (this will prevent further logs transmission) use end() method.

Both methods accepts optional callback which will fire when logs are flushed or error occurs during sending logs.

Hacks

If DISABLE_CLOUD_LOG environment variable is set, logger is doing nothing. All calls to log() are ignored.

FAQs

Package last updated on 21 Jun 2016

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