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

clear-logs

v1.0.0

Published

A cool way to show logs on node js

Downloads

200

Readme

Clear logs

alt text

A lib to provide more context around logs, making them clear and easy to display.

1. Install & import

npm install clear-logs

const logger = require('clear-logs');

2. Just use it

logger.log( 'Something', 'something 2', 'something 3');

Where the methods are the same as the ol' good console:

  • log
  • error
  • info
  • warn
  • debug

3. Done!


Advanced config (Hey, maybe you need something else)

You can setup some aditional configurations to shape the logger for your needs. Just set using the config method:

logger.config( { /* opts */ } );

Where your options are:

| prop | default | descr | | ---- | ------- | ----- | | console | console | This is the node console, used to stdout the stuff. You can pass your own console here, if you need. Just dont forget to have the same methods as the normal console (log info, warn, error, debug) | | appendix | null | Info to prepend to all your logs | | stackUp | 4 | How much going thru the Error.stack to get the line, file and fn name for logging. Don't mess with this unless you really need too. | | envs.production | [ 'error', 'log', 'warn' ] | What methods will actually output when NODE_ENV === 'production' | | envs.staging | [ 'error', 'log', 'warn' ] | What methods will actually output in when NODE_ENV === 'staging' | | envs.test | [ 'error' ] | What methods will actually output when NODE_ENV === 'test' | | envs.development | [ 'error', 'log', 'warn', 'debug', 'info' ] | What methods will actually output when NODE_ENV === 'development' |

So, lets say you dont want to polute your tests with logs, but want those in the production version of your app, you can config as following:

logger.config( { 
  envs: {
    test: [] 
  } 
});

So now, no stdout will be made in this environment.

Enjoy!