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

log-talk

v1.1.0

Published

Simple logger designed for browser and node. It logs with line number and color.

Downloads

19

Readme

log-talk

Simple logger designed for browser and terminal.

  • Line number where a bug occured (only for browser console now)
  • Timestamp when a bug occured
  • Highlight
  • Observe log message
  • Customizable

Usage

Use npm to install.

npm install --save log-talk
const LogTalk = require('log-talk');
const logger = new LogTalk();

// Default methods
logger.debug('This is debug');
logger.info('This is info', { message: 'Hello' });
logger.success('This is success');
logger.warn('This is warn');
logger.error('This is error', new Error('There is something wrong'));

// Define your own method
logger.setMethod({ name: 'foo', color: 'yellow', timeFormat: '[[]YYYY-MM-DD HH:mm:ss]' });
logger.foo('Foo');

// Override default methods
logger.setMethod({ name: 'info', color: 'red' });
logger.info('Now the label is red');

You can see this demo here on your browser.

Screenshot

screenshot

Log level

You can hide low level log such as debug.

const LogTalk = require('log-talk');
const minLevel = 3;
const logger = new LogTalk(minLevel);

Label

Set label option to customize label.
If you don't set label, name option is used as label.

const LogTalk = require('log-talk');
const logger = new LogTalk();
logger.setMethod({ name: 'foo', label: 'Foo' });

Time format

Set timeFormat option to customize time format.

const LogTalk = require('log-talk');
const logger = new LogTalk();
logger.setMethod({ name: 'foo', timeFormat: 'YYYY-MM-DD' });

It depends on Day.js to generate time string.
Formatting rules are here.

Highlight

Set color option to highlight.
NOTE: IE ignores color.

const LogTalk = require('log-talk');
const logger = new LogTalk();
logger.setMethod({ name: 'foo', color: 'yellow' });

These are defined colors.

  • default
  • blue
  • green
  • yellow
  • red

It's not flexible and few though.
I will improve it soon.

Default Methods

| name | level | color | |:--------|------:|:--------| | debug | 1 | default | | info | 2 | blue | | success | 3 | green | | warn | 4 | yellow | | error | 5 | red |

Browser Support

  • IE@11
  • Edge
  • Firefox
  • Chrome
  • Safari