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

@blacklane/kiev-js

v2.0.2

Published

A simple logging library to generate JSON formatted logging messages.

Downloads

37

Readme

Kiev-js

Build Status

Kiev-js is a wrapper logging library around LogLevel implementing Blacklane logging standards.

Setup instructions

Requirements

Installation

npm install @blacklane/kiev-js

Usage

import {Logger, LoggerConfig, LogLevel} from '@blacklane/kiev-js'

const environment = process.env.NODE_ENV || 'development'

let loggerConfiguration: LoggerConfig = {
  application: 'application-name',
  environment: environment,
  initializedFields: { foo: 'foo', bar: 'bar' }, // it is optional and will be added to all log entries
  filterFields: ["password", "accessToken"] // it is optional and will filter the content of the field
}

// Default level is 'warn'
logger = new Logger(loggerConfiguration)

// This won't be logged due to the default level
logger.debug('Something happening here', { foo: 'bar' })

// Next line will be logged
// The payload will override any field defined in the constructor
logger.warn('WARN! Look at this', { foo: 'bar', password: "Hard_One" })

// => {"application":"application-name","environment":"development","level":"WARN", message: "WARN! Look at this", "timestamp":"2020-10-15T10:51:32.621Z", "foo": "bar", "bar": "bar", "password": "[FILTERED]}


// Setting logger to 'debug' level
logger.setLevel(LogLevel.DEBUG)

logger.debug('FooBar', { fizz: 'buzz' }) // Now it will be logged

// => {"application":"application-name","environment":"development","level":"DEBUG", message: "FooBar", "timestamp":"2020-10-15T10:51:32.621Z", "fizz": "buzz", "foo": "foo", "bar": "bar"}

// Create a new logger based on the current one
const newLogger = logger.extend({ tracking_id: "an tracking ID" })

// tracking_id will be present on all logs produced by this logger
newLogger.info('GET / - 200 OK')
// => {"application":"application-name","environment":"development","level":"INFO", message: "GET / - 200 OK", "timestamp":"2020-10-15T10:51:32.621Z", "foo": "foo", "bar": "bar", "tracking_id": "an tracking ID"}

Contributing

  1. Pull the code:
git clone [email protected]:blacklane/kiev-js.git
  1. Install dependencies
npm install
  1. Run tests:
npm test
  1. Create your feature branch (git checkout -b my-new-feature)
  2. Commit your changes (git commit -am 'Add some feature')
  3. Push to the branch (git push origin my-new-feature)
  4. Create a new Pull Request

Tests & Linter

  • Run unit tests: npm run test
  • Run tests watch & coverage: npm run test:cov
  • Run Linter: npm run lint