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

@winkgroup/console-log

v3.0.3

Published

Enhanced logging class

Downloads

9

Readme

console-log

enhanced logging library

Install

npm install @winkgroup/console-log

Usage

import ConsoleLog from '@winkgroup/console-log'

consoleLog = new ConsoleLog()
consoleLog.print('hello world!')

you can set prefix and id properties that will become part of header of each log:

import ConsoleLog from '@winkgroup/console-log'

consoleLog = new ConsoleLog({prefix: 'CoolLog', id: '1'})
consoleLog.print('hello world!')

// will print: CoolLog (1): hello world!

API

ConsoleLog(GeneralOptions, SpecificOptions)

GeneralOptions and SpecificOptions are two optional objects.

methods:

  • ConsoleLog.print(message, [logLevel]): message is a string; logLevel is a value from LogLevel
  • ConsoleLog.debug(message): shortcut of print method with DEBUG LogLevel
  • ConsoleLog.warn(message): shortcut of print method with WARN LogLevel
  • ConsoleLog.error(message): shortcut of print method with ERROR LogLevel
  • ConsoleLog.spawn(GeneralOptions): it generates a new ConsoleLog object that inherits same options of original with some updates according with parameters passed

GeneralOptions

all the attributes of this object are optional:

  • GeneralOptions.id: an id that will be shown for each log
  • GeneralOptions.prefix: a prefix that will be shown for each log
  • GeneralOptions.timestampFormat: a timestamp with these possible values: 'full', 'time', 'milliseconds', 'none' (default)
  • GeneralOptions.verbosity: every log that is below this LogLevel will have no action

SpecificOptions

all the attributes of this object are optional, all those not declared will be inherited by GeneralOptions:

  • SpecificOptions.id: an id that will be shown for each log
  • SpecificOptions.prefix: a prefix that will be shown for each log
  • SpecificOptions.timestampFormat: a timestamp with these possible values: 'full', 'time', 'milliseconds', 'none' (default)
  • SpecificOptions.levels: LogLevel to those this option has to be applied, single level can be expressed. If this attribute is not set, then these options will be applied to any LogLevel
  • SpecificOptions.action: object containing one of these actions: 'console' | 'file' | 'error' | 'none'

LogLevel

ConsoleLog comes with five verbosity levels:

  • DEBUG = 4
  • INFO = 3
  • WARN = 2
  • ERROR = 1
  • NONE = 0

Tips

chalk v5 does't work properly in commonjs. To upgrade to minor version with ncu the command is

ncu -u -t minor

Maintainers