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

@bizcuit/logger

v2.0.1

Published

Pino Logger for Lambdas

Downloads

4

Readme

logger

Logger using Pino, use with lambdas

Usage

import { log, sniff, logFatalAndReturn } from '@bizcuit/logger';

// Logger basic useage
log.trace({ logData }, 'Logging some important string we need');        // Level 10
log.debug({ logData }, 'Logging some important string we need');        // Level 20
log.info({ logData }, 'Logging some important string we need');         // Level 30
log.warn({ logData }, 'Logging some important string we need');         // Level 40

// Error should always take as first argument an Error object
// (or a custom Error message which inherits from Error)
log.error(new Error('My err message'), 'Extra message if desired')      // Level 50
// OR
(new Promise((res, rej) => rej(new Error('My err'))))
    .catch(err => log.error(err, 'Extra message if desired'));          // Level 50

log.fatal({ logData }, 'Logging some important string we need');        // Level 60

/**
 * @note
  * The format of this message in a `log.event` call is **EXCEPTIONALLY** important
  * It is the message that is entered here that will be what other parts of the system
  * will filter on to receive the event generated by this lambda.
  * If it's not in this format it will simply be discarded
  * Similarly the event **must** be called `event` and wrapped in an object, else discarded
  */
log.event({ event }, 'SERVICE|FUNCTION');

// Sniffing out data from inside promise chains
const spicyDataPromise = new Promise.resolve({ spicyData: '🌶' });

spicyDataPromise.then(sniff('debug', 'Logging the contents of SpicyDataPromise', 'spicyData'))
  .then(doSomethingElse);

// LogFatalAndReturn
const { SHOULD_NOT_BE_UNDEFINED } = process.env;

if (isUndefined(SHOULD_NOT_BE_UNDEFINED)) logFatalAndReturn('A required env var was not present');