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

andlog

v1.0.2

Published

Super-simple, client-side CommonJS logging thingy

Downloads

7,624

Readme

&log

Super simple, but solves these pain points:

  • Lets you leave log statements in production, client-side code.
  • It won't log anything unless localStorage.debug is set.
  • Uses native console rather than trying to wrap it in something (which makes the output ugly).
  • Works with CommonJS.
  • It's just a selective alias for the window.console so the normal API applies.

How to use it:

Step 1. include it:

<script src="andlog.js"></script>

Step 2. Use the console in your code as usual:

console.log("hello");

Step 3. If you want to see log output set a value called debug in localStorage by doing typing this in console:

localStorage.debug = true

If you'd like to use a custom debug key then set localStorage.andlogKey = 'something-else' and then set localStorage['something-else'] = true to enable logging.

Step 4. Refresh the page, you should now see logs.

Step 5. To turn off console, just delete the localStorage flag:

delete localStorage.debug

Step 6. Feel free to deploy to production with console stuff in there.

CommonJS Version

If you're using this on the client but your project is in node.js you can install this with: browserify and npm.

var logger = require('andlog');

logger.log('hello');

This is identical to:

console.log('hello');

You could even get fancy and call it console. However by doing this you take the risk that you'll forget to require it and it'll still work and you'll ship it to production. However, obviously this would work as well:

var console = require('andlog');

console.log('hello');

Releases

  • 1.0.2 bug fix to make sure ls is always defined.

License

MIT

If you like this, follow @HenrikJoreteg on the twitterwebz.