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

@evokegroup/console-logger

v1.0.3

Published

Logs timestamped messages to the console.

Downloads

82

Readme

@evokegroup/console-logger

Logs timestamped messages to the console.

Class: ConsoleLogger

const ConsoleLogger = require('@evokegroup/console-logger');
ConsoleLogger.log('Log this message');
// Expected result: [HH:mm:ss] Log this message

Static Properties

ConsoleLogger.Style

| Name | Description | | ---- | ----------- | | Background | Background colors | | Background.Black | | | Background.Blue | | | Background.Cyan | | | Background.Gray | | | Background.Green | | | Background.Magenta | | | Background.Red | | | Background.White | | | Background.Yellow | | | Background.BrightBlue | | | Background.BrightCyan | | | Background.BrightGreen | | | Background.BrightMagenta | | | Background.BrightRed | | | Background.BrightWhite | | | Background.BrightYellow | | | Foreground | Foreground colors | | Foreground.Black | | | Foreground.Blue | | | Foreground.Cyan | | | Foreground.Gray | | | Foreground.Green | | | Foreground.Magenta | | | Foreground.Red | | | Foreground.White | | | Foreground.Yellow | | | Foreground.BrightBlue | | | Foreground.BrightCyan | | | Foreground.BrightGreen | | | Foreground.BrightMagenta | | | Foreground.BrightRed | | | Foreground.BrightWhite | | | Foreground.BrightYellow | | | Inverse | Inverse of default style | | Reset | Resets to default style | | Underscore | Underscores the text |

Static Methods

ConsoleLogger.setStylesEnabled(flag)

Enable or disabled styles globally.

ConsoleLogger.setTimestampEnabled(flag)

Enable or disabled timestamps globally.

ConsoleLogger.setTimestampStyle(styles)

Set timestamp style globally.

ConsoleLogger.log(message, styles, timestamp = true)

Logs a message with given styles.

const ConsoleLogger = require('@evokegroup/console-logger');
ConsoleLogger.log('Log this message');
ConsoleLogger.log('Another message in blue', ConsoleLogger.Style.Foreground.Blue);
ConsoleLogger.log('Underscored in green with no timestamp', [ConsoleLogger.Style.Foreground.Green, ConsoleLogger.Style.Underscore], false);
ConsoleLogger.log([
  new ConsoleLogger.MessagePart('red', ConsoleLogger.Style.Foreground.Red),
  new ConsoleLogger.MessagePart(' green', ConsoleLogger.Style.Foreground.Green)
]);

Parameters

| Name | Type | Default | Description | | ---- | ---- | ------- | ----------- | | message | Array<ConsoleLogger.MessagePart>, ConsoleLogger.MessagePart, string | | The message to be logged | | styles | Array<ConsoleLogger.Style>, ConsoleLogger.Style | | The style of the message | | timestamp | boolean | true | Print a timestamp |

ConsoleLogger.error(message, timestamp = true)

Logs a message in red.

const ConsoleLogger = require('@evokegroup/console-logger');
ConsoleLogger.error('error');

ConsoleLogger.info(message, timestamp = true)

Logs a message in cyan.

const ConsoleLogger = require('@evokegroup/console-logger');
ConsoleLogger.info('info');

ConsoleLogger.warn(message, timestamp = true)

Logs a message in yellow.

const ConsoleLogger = require('@evokegroup/console-logger');
ConsoleLogger.warn('warn');

Class: ConsoleLogger.MessagePart

constructor(text, styles)

ConsoleLogger.log([
  new ConsoleLogger.MessagePart('red', ConsoleLogger.Style.Foreground.Red),
  new ConsoleLogger.MessagePart(' green', ConsoleLogger.Style.Foreground.Green)
]);

Properties

| Name | Type | Description | | ---- | ---- | ----------- | | text | string | The text to log | | styles | Array<ConsoleLogger.Style>, ConsoleLogger.Style | The style to apply to the text |