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

@techytools/cconsole

v0.1.0

Published

No dependencies. No setup required. Easily integrate with Cloud logging (LogDNA, etc). Visually group similar types of logs in the terminal. Show a concise file/line trace for each message - so you can actually find where it's originating without looking

Downloads

1

Readme

TODO:

  1. currently adding type checking
  2. bundle exports for CommonJS and browser (window)

Add color to your console messages

No dependencies. No setup required. Easily integrate with Cloud logging (LogDNA, etc). Visually group similar types of logs in the terminal. Show a concise file/line trace for each message - so you can actually find where it's originating without looking through the entire codebase.

Example screenshot

Works on both Node.js and in Browser. Colors do not work inside IDEs like CodePen.io. Scroll down for browser usage. This is code still experimental and will change until version 1. Do not install @latest, but stick to a well-tested current version.

npm package testing in progress

Use in Node.js (CommonJS or ES Modules)

See example usage in ./examples folder!

1. Import it:

const cconsole = require('@techytools/cconsole');

Name it whatever you want (konsole, consola, consolee)

2. Use it:

cconsole.time();
cconsole.clear();
cconsole.log('no special colors');
cconsole.info('light blue (teal/aqua) background');
cconsole.warn('this is a warning, yellow/orange background');
cconsole.error('Error: bright red background, yellow text');
cconsole.trace('TEST log trace');
cconsole.error(new Error('TEST log error'));
cconsole.table([[1, 2, 3, 4, 5], ['a', 'b', 'c', 'd', 'e']]);
cconsole.timeEnd();

3. Advanced usage:

const cconsoleInit = require('@techytools/cconsole/cconsoleInit');

globals['cconsole'] = cconsoleInit({
  useTrace: true, // show file and line-number where the console was called from
  useColor: true, // add a splash of color, to find the info, warn, or debug more easily
  separateTypes: true, // put a space between groups of similar types (logs, infos, warns)
  logToCloud: {
    log: customCloudLogFunction,
    info: customCloudInfoFunction,
    warn: customCloudWarnFunction,
    error: customCloudErrorFunction
  }
})
// the globals variable is just a suggestion, so you don't have to keep initiating it in every file

Use in browser

Auto-init with default options:

1. Import it:

<script src="https://raw.githubusercontent.com/paulshorey/@techytools/cconsole/main/dist/cconsole.js"></script>
<!-- this script will add window.cconsole variable to your webpage -->

2. Use it:

cconcole.info('this message will have background light blue')
cconcole.warn('this message will have background yellow')
cconcole.error('this message will have background red with yellow text')

3. Advanced usage:

<script src="https://raw.githubusercontent.com/paulshorey/@techytools/cconsole/main/dist/cconsoleInit.js"></script>
<!-- this script will add window.cconsoleInit variable to your webpage -->

const cconsole = cconsoleInit({
  useTrace: true, // show file and line-number where the console was called from
  useColor: true, // add a splash of color, to find the info, warn, or debug more easily
  separateTypes: true, // put a space between groups of similar types (logs, infos, warns)
  logToCloud: {
    log: customCloudLogFunction,
    info: customCloudInfoFunction,
    warn: customCloudWarnFunction,
    error: customCloudErrorFunction
  }
})

cconcole.info('this message will have background light blue, and will log to your cloud provider')

Development

Run dev:

npm install && npm run dev This will run Parcel with --watch flag. Changes from ./src folder will be written to ./dist. Experiment in ./examples folder.

Test:

npm run test No coverage for now. It runs the examples (./examples/cconsole*.js files). It's difficult to test console logs. So, this does not test what colors (if any) are printing out, or if all the options are working. Just checks if the code threw an error, or if it ran successfully.

Build, commit, push:

git commit triggers "pre-commit" hook which runs linting and testing, and fails if something fails. If successful, then it will npm run build and git add ., then git push.

About

Made by Paul Shorey for personal projects, for future clients and employers, for everyone. This is a work in progress.