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

@scaleleap/logger

v1.9.13

Published

A universal logger for Scale Leap applications based on Pino.

Downloads

76

Readme

📦 @scaleleap/logger

A universal logger for Scale Leap applications based on Pino.


Download & Installation

npm i -s @scaleleap/logger

Usage

createLogger(options?: LoggerOptions)

The createLogger function returns a pre-configured Pino instance. Optional parameters can be passed to amend default configuration.

Example:

import { createLogger } from '@scaleleap/logger'

const log = createLogger()

log.info('Hello world')

createTestLogger(options?: LoggerOptions)

Creates a logger suitable for tests. It does not write anything to screen, and instead writes to an ObjectWritableMock.

Logger instance has two additional properties:

  • writableMock: ObjectWritableMock instance
  • logLines(): a method that parses the JSON log to a LogDescriptor format

Example:

import { createTestLogger } from '@scaleleap/logger'

const logger = createTestLogger()

logger.info('foo')

const logLines = logger.logLines()

expect(logLines[0].msg).toBe('foo')

log

An auto-instantiating logger instance.

An instance of logger will be created by using it.

Suitable for quick prototyping and quick scripts.

Example:

import { log } from '@scaleleap/logger'

log.info('Hello world')

Environment Variables

You can control logger behavior through a set of environment variables:

  • LOGGER_NAME: Sets the logger name.
  • LOGGER_LEVEL: Sets the log level that will be emitted. See Log Levels.
  • LOGGER_ENABLED: Enables or disables the logger. Default is true.

Log Levels

The following log levels are supported:

  • trace
  • debug
  • info
  • warn
  • error
  • fatal
  • silent

The following defaults are used, based on NODE_ENV values:

  • development = debug
  • test = error
  • production = info

Heroku Log Parser

Parses Heroku logs and removes the prefix so that we can pipe it:

heroku logs | heroku-logs-parser | pino-pretty

AWS Lambda environment

Automatically adds the following environment variables to base, when running in the AWS Lambda environment:

{
  memorySize: process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE,
  region: process.env.AWS_REGION,
  runtime: process.env.AWS_EXECUTION_ENV,
  version: process.env.AWS_LAMBDA_FUNCTION_VERSION,
}

Contributing

This repository uses Conventional Commit style commit messages.

Authors or Acknowledgments

License

This project is licensed under the MIT License.

Badges

GitHub Workflow Status NPM License Coveralls Semantic Release