Socket
Socket
Sign inDemoInstall

@thetimes/logless

Package Overview
Dependencies
1
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @thetimes/logless

A simple logger


Version published
Maintainers
4
Install size
24.7 kB
Created

Readme

Source

logless

Build Status Coverage Status npm version

About

Logless is a lightweight logging library specially crafted for serverless apps.

Install

npm install --save @thetimes/logless

Usage

const loggerFactory = require("@thetimes/logless");

const config = { logLevel: "debug" };

const log = loggerFactory(config, requestID);

log("something's up!");

Using a custom log function

By default logless uses console.log as a log function. But you can define your own by passing it as a config parameter:

const loggerFactory = require("@thetimes/logless");

const myCustomLogFunction = msg => process.stdout.write(msg);

const config = {
  logLevel: "warn",
  logFn: myCustomLogFunction
};

const log = loggerFactory(config, requestID);

log("something's up!");

API

Available log levels: silly|debug|verbose|info|warn|error

factory(config, requestId):

  • config (object): { logLevel, logFn }
    • logLevel (string): the level of logging. All levels below this will not be logged
    • logFn (function): custom log function (if ommited uses console.log)
  • requestId (string): the id of the request being logged

Returns a log function.

log(message):

  • message (string): the message to be logged

Returns void.

Contributing

See the CONTRIBUTING.md for a breakdown of the project

Keywords

FAQs

Last updated on 26 Sep 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc