Socket
Book a DemoInstallSign in
Socket

atlas-basic-logger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atlas-basic-logger

A very simple debug logger.

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

atlas-basic-logger

A very simple debug logger.

install

npm install --save atlas-basic-logger

why

I just need a simple error-first Logger which lets me avoid using console.log (for testability), while making my business logic cleaner and more concise.

examples

Both debug and concise mode can be used to do error-first logging. If an error is passed to the logger, it'll print it (or just the message in concise mode), otherwise it'll attempt to print the second argument.

debug mode

This will print the error to stderr, if it exists, otherwise it will print the full result to stdout, if it exists.

const Logger = require("atlas-basic-logger");
const isDebug = true;
const log = Logger(isDebug)
reddit.deleteAccount("atlassubbed", (err, res) => {
  log(err, res)
})
// or, in fewer lines
reddit.deleteAccount("atlassubbed", log)

concise mode

This will print the error's message to stderr, if it exists, otherwise it will print the full result to stdout, if it exists.

const log = require("atlas-basic-logger")();
reddit.deleteAccount("atlassubbed", (err, res) => {
  log(err, res)
})
// or, in fewer lines
reddit.deleteAccount("atlassubbed", log)

Keywords

atlassubbed

FAQs

Package last updated on 26 Jun 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.