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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jsw-logger

v1.2.6

Published

Javascript logging module that inherits Winston Logger (https://github.com/winstonjs/winston) module.

Downloads

91

Readme

JSW-Logger

Javascript logging module which writes in the console all warnings and erros

Package Version NodeJS Version

Linux Build Windows Build Test Coverage Downloads Documentation Status

CodeClimate GPA CodeClimate Issues CodeClimate Coverage

Codacy

Installation

npm install --save jsw-logger

Usage

Currently, JSW-Logger can be used within a TypeScript based project, as a node dependency or directly in the browser.

Declaration:

First we need to import the dependency:

Typescript

import { JSWLogger } from "jsw-logger";

Node JS

var JSWLogger = require("jsw-logger").JSWLogger;

Browser

<script src="path/to/deps/dist/jsw-logger.min.js"></script>
<!-- This exposes a global "JSWLogger" variable -->

Instantiating

We can instanciate the logger passing a bunch of options:

var Logger = JSWLogger.getInstance({
    level: 2,   // logs "info", "warn" and "error" by default
    hideAllLogs: false, // hides messsages from being logged
    hideLevelLog: false,    // hides the "LOG: " from the begining of the message
    throwError: true   // throw an error when "Logger.throw"
});

Or we can retrieve the instance with the options by default:

var Logger = JSWLogger.instance;

Also, the options can only by setted when instantiating with the first way. To change them, we should access the options object: Logger.options.throwError = false Or we can drop the instance so we can regenerate it: JSWLogger.__dropInstance()

Note that as this is a singleton (can only be instantiated once), so if you drop the instance, it will be dropped for all

Logging

The level logging hierarchy is as follows:

| Name | Level | Method | Uses | |---------|-------|--------------------|-----------------------------------------------------------| | Silly | 6 | Logger.silly | Some dummy logs, less relevants than a debug | | Debug | 5 | Logger.debug | For debugging purposes | | Verbose | 4 | Logger.verbose | For extended log messages | | Log | 3 | Logger.log | The standar logging | | Info | 2 | Logger.info | To show relevant information messages | | | | Logger.inform | Works as an alias for "info" | | | | Logger.information | Worksas an alias for "info" | | Warn | 1 | Logger.warn | To show application warnings | | | | Logger.warning | Works as an alias for "warn" | | Error | 0 | Logger.error | To output error generated by the application | | | | Logger.throw | Same as "error", but throws an Exception is configured to |

The lower we set the level whe instanciating, the less methods will output something. Eg.:

Logger.debug("Not shown"); // -> outputs nothing, as the default is log (2)
Logger.info("Some informative message"); // -> INFO: Some informative message
// Can use interpolation
Logger.warn("Be careful %s!", "Ryan"); // -> WARN: Be careful Ryan!
Logger.error("Line %d doesn't compile", 562); // -> ERROR: Line 562 doesn't compile

License

MIT