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

@nikersify/log

v1.0.1

Published

tiny logging utility

Downloads

2

Readme

log

tiny logging utility

screenshot

# logs/?.log
(21-03-2017 20:03) [INFO] [app] starting...
(21-03-2017 20:03) [SUCCESS] [app] read config.json
(21-03-2017 20:03) [INFO] [app] started in development mode
(21-03-2017 20:03) [INFO] [db] attempting to connect...
(21-03-2017 20:03) [WARN] [db] credentials missing, trying defaults...
(21-03-2017 20:03) [SUCCESS] [db] connected!
(21-03-2017 20:03) [INFO] [http] preparing html cache...
(21-03-2017 20:03) [SUCCESS] [http] cache ready!
(21-03-2017 20:03) [ERROR] [http] missing ssl certs
(21-03-2017 20:03) [INFO] [http] server listening on port 3090
(21-03-2017 20:03) [TRACE] [http] 54.73.249.176 POST /api/get_thing 400
(21-03-2017 20:03) [TRACE] [http] 184.133.232.60 GET /
(21-03-2017 20:03) [TRACE] [http] 184.133.232.60 GET /favicon.ico 404
(21-03-2017 20:03) [FATAL] [app] spaghetti monster ate us

example

const log = require('@nikersify/log')

log.info('app', 'starting...')
log.success('app', `read ${log.e('config.json')}`)
log.info('app', `started in ${log.e('development')} mode`)
log.info('db', 'attempting to connect...')
log.warn('db', 'credentials missing, trying defaults...')
log.success('db', 'connected!')
log.info('http', 'preparing html cache...')
log.success('http', 'cache ready!')
log.error('http', 'missing ssl certs')
log.info('http', `server listening on port ${log.e(3090)}`)
log.trace('http', '54.73.249.176 POST /api/get_thing 400')
log.trace('http', '184.133.232.60 GET /')
log('uber debug msg!!')
log.trace('http', '184.133.232.60 GET /favicon.ico 404')
log.fatal('app', 'spaghetti monster ate us')

methods

log(msg)

Use for debugging, not saved to .log's, hidden if NODE_ENV === 'PRODUCTION'.

log.[level]([scope], message)

Where scope is optional and level can be one of the following:

  • info - not the most important information
  • warn - things might be going funky
  • error - bad, but doesn't crash
  • fatal - oh lord.
  • success - something goes right for once
  • trace - http server logs, db logs, spam, etc.

Prints out a nicely formatted line and saves to .log's.

log.e(msg)

Emphasize a word or two, used as the following

log.success('app', `read ${log.e('config.json')}`) 

log.inspect(object)

Stdout a deep representation of the given object.

install

npm install --save @nikersify/log

license

MIT