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

pinomin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pinomin

Minimalistic logger compatible with pino

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
339
decreased by-18.12%
Maintainers
1
Weekly downloads
 
Created
Source

pinomin

Minimalistic JSON logger compatible with pino logger. Pino uses lot of optimalizations to be super fast. Sometimes, these optimalizations could cause problems and you need only to create few simple logs. pinomin is naive logger implemented in one file, thanks to compatibility, you could upgrade to pino, if you need better performance.

Install

Using NPM:

$ npm install pinomin

Using YARN:

$ yarn add pinomin

Usage

const { createLogger } = require('pinomin');

const logger = createLogger();

logger.info('hello world');

const child = logger.child({ a: 'property' });
child.info('hello child!');

This produces:

{"level":30,"time":1531171074631,"msg":"hello world"}
{"level":30,"time":1531171082399,"msg":"hello child!","a":"property"}

Configure logger

Configuration is different from pino, you could define multiple targets by default.

const logger = createLogger({
  base: { pid: process.pid },
  targets: [
    {
      type: 'console',
      level: process.env.CONSOLE_LOG_LEVEL || process.env.LOG_LEVEL || 'info',
    },
    {
      type: 'stream',
      level: process.env.FILE_LOG_LEVEL || process.env.LOG_LEVEL || 'info',
      stream: fs.createWriteStream('/etc/logs/mylogs.txt', { flags: 'a' }),
    },
  ],
});
  • There are two types of target available
    • console outputs JSON log messages to console with console.log
    • stream writes JSON log messages to stream property
  • base property defines base object to be merged into produced JSON log messages

Development Formatting

pinomin uses the same format as pino logger, so pino-pretty module could be used for producing nice log outpus during development.

pretty demo

Keywords

FAQs

Package last updated on 27 May 2024

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