New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

anotherlog

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anotherlog

Another Node.js logger. Wraps Winston.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

anotherlog

Build Status

Another Node.js logging module. For now this wraps Winston and provides a preconfigured standardised logger for use in our microservices and other projects.

Getting started

First, install anotherlog using npm:

    npm i anotherlog

Then, require the package and use it like so:

    const log = require('anotherlog')('MyService')
    
    log.info('Hello World')
    // '2017-06-12T16:16:09.222Z (MyService) [INFO] - Hello Small World'

API

anotherlog(name, options={level})

Instantiate a logger. Requires a name (i.e the name of the service).

.debug(message, meta)

Lowest level of logging. Hidden by default. Set log level to 'debug' to see these. Useful for development.

.info(message, meta)

Standard log message. Output to stdout

.warn(message, meta)

Non critical errors. Output to stderr

.error(message, meta)

Critical errors. Output to stderr

.intercept(data)

Debug print data and return. Useful for intercepting promise chains. Requires debug level to show.

Promise.resolve({one: 'one', two: 'two'})
  .then(log.intercept) // {"one": "one", "two": "two"}
  .then(data => data.two)
  .then(log.intercept) // "two"
  .then(data => {
    // do something
  })

.setLevel(level)

Set the minimum log level to output. If NODE_ENV set to development defaults to debug. Otherwise defaults to info

Notes

NODE_ENV=development will change the output emitted by this library. In development mode a warning is printed to the screen and messages are logged in a human readable format. When running in production all messages are logged as machine readable JSON.

Contributing

To report bugs or request features, submit issues here on GitHub, concrete-cc/anotherlog/issues. Pull requests are also welcome.

License

MIT

FAQs

Package last updated on 29 Aug 2017

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