npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@diva.exchange/diva-logger

v1.0.1

Published

Modern, fast, lightweight and generic pino-based logger

Downloads

9

Readme

Modern, fast and lightweight Logger

Modern, fast, lightweight and generic logger. It's based on pino (https://www.npmjs.com/package/pino).

How to Install

npm install @diva.exchange/diva-logger

Getting Started - Usage

Use it either as

import { Logger } from '@diva.exchange/diva-logger'

Logger.trace('hello world')

or

const Logger = require('@diva.exchange/diva-logger')

Logger.trace('hello world')

API

diva-logger is static. It can be used without instantiation, like

import { Logger } from '@diva.exchange/diva-logger' 

try  {
    throw new Error('A recoverable error')
} catch (error) {
    Logger.warn(error)
    // go on
}   

diva-logger also attaches itself gently to the two global events uncaughtException and unhandledRejection. Hence an unhandled exception or an unhandled rejected promise will be properly logged (fatal):

import { Logger } from '@diva.exchange/diva-logger' 

throw new Error('This is fatal')

After an unhandled exception or unhandled rejected promise, the process will be terminated with the exit code 1 (after the remaining event stack has been processed).

Chaining

diva-logger supports chaining, like

Logger.trace('trace message').debug('debug message')

Logging Examples, Usage of API

trace(any[, options])

Logger.trace('some trace message')
Logger.trace(process.env)

debug(any[, options])

Logger.debug(12345)

info(any[, options])

Logger.info('info goes here')

warn(any[, options])

Logger.warn('warning - recoverable error')

error(any[, options])

Logger.error('some serious error')
Logger.error(SomeObject)

fatal(any[, options])

Logger.fatal('One of the last messages of the process...')

How to Run Unit Tests

npm run test

Coverage reports are stored within ./coverage. Use any browser and open ./coverage/index.html.

How to Lint (eslint)

npm run lint

Contact the Developers

On DIVA.EXCHANGE you'll find various options to get in touch with the team.

Talk to us via Telegram https://t.me/diva_exchange_chat_de (English or German).

Donations

Your donation goes entirely to the project. Your donation makes the development of DIVA.EXCHANGE faster.

XMR: 42QLvHvkc9bahHadQfEzuJJx4ZHnGhQzBXa8C9H3c472diEvVRzevwpN7VAUpCPePCiDhehH4BAWh8kYicoSxpusMmhfwgx

BTC: 3Ebuzhsbs6DrUQuwvMu722LhD8cNfhG1gs

Awesome, thank you!