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

apheleia

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apheleia

A simplistic logger.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

apheleia

Build Status Coverage Status NPM version JavaScript Style Guide

A simplistic logger supporting any Writable stream and custom formats.

Installation

npm i apheleia

API

createLogger([options])

Creates a new Logger instance with a single transport.

const { createLogger, SimpleFormat } = require('apheleia')
const fs = require('fs')

const logger = createLogger({
  stream: fs.createWriteStream(__dirname + '/app.log'),
  format: new SimpleFormat()
})
logger.info('hello world')
stream (optional)

A Writable stream. If undefined a ConsoleTransport will be used.

format (optional)

A format. Defaults to a instance of SimpleFormat.
Formats must implement the following interface:

interface Format {
  transform (level: string, message: string, args: any[], meta: object | undefined)
}
levels (optional)

The levels used by the logger.

level (optional)

Sets the log level of the logger.

transports (optional)

Allows to set the transport of the logger.

SimpleFormat([options])

Logger

Logger#end(callback)

Ends the logger by calling end() on every transport and then calls the callback.

Logger#trace(message, ...args)

Writes a TRACE level log, if allowed by the level option.

Logger#debug(message, ...args)

Writes a DEBUG level log, if allowed by the level option.

Logger#info(message, ...args)

Writes a INFO level log, if allowed by the level option.

Logger#warn(message, ...args)

Writes a WARN level log, if allowed by the level option.

Logger#error(message, ...args)

Writes a ERROR level log, if allowed by the level option.

Logger#fatal(message, ...args)

Writes a FATAL level log, if allowed by the level option.

Transport(options)

Creates a new Transport instance.

new Transport({
  stream: process.stdout,
  format: new SimpleFormat()
}
format

A format used to stringify the parameters passed to the loggers methods.

level

Sets the log level of the logger.

ConsoleTransport(options)

format

A format used to stringify the parameters passed to the loggers methods.

License

MIT

Keywords

FAQs

Package last updated on 26 Jan 2019

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