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 🙏

© 2026 – Pkg Stats / Ryan Hefner

primitive_logger

v1.0.3

Published

Very simple Logger

Readme

Primitive Logger

A very simple logger module intended for use by a short running utilities.

Instead of usual log levels, this logger uses message types. There is no relationship between message types, which means that you have to explicitly specify types that you want to see in the output. Also I did add few convenience functions for generic message types, there is no restriction on custom types. You can create any type that you like and, as long as it is listed in the options, logger will work with it.

Logger can write messages to the console or/and to the log file(s). To write to console, use keyword "stdout" for the filename in the list of outputs.

You can define individual list of message types for each output file.

What this logger doesn't do at this time:

  • If objects are included into string, it doesn't convert such objects into text.
  • There is no provision for rotating or limiting size of the log files.
  • There are no options to customize date and type outputs

Usage

Install with npm

npm install --save primitive_logger
// Example 1
const lr = require('primitive_logger')
const Logger = lr.Logger

var options = {
	logger: {
		types: ["stats","error"],
		format: { 
			date: {show: true},
			type: {show: true}
		},
		outputs: [
			{	file: "stdout",
				types: ["error","stats"]
			},
			{	file: "output.log", 
				types: ["stats","error","info","debug"]
			}
		]
	}
}

logger = new Logger(options);

logger.stats("This is stats message");
logger.info("This is info message");
logger.error("This is error message");
logger.log("debug","This is debug message");
logger.debug("This is another debug message");
logger.log("whatever","This is whatever message");
// Example 2. Display only custom message "troubleshoot" in console
const lr = require('primitive_logger')

logger = new lr.Logger({logger: {types: ["troubleshoot"]}});

logger.log("troubleshoot", "This is troubleshoot message. Should see it.");
logger.log("debug", "This debug message should not print");

log( type, message )

log message of specified type

  • type string
  • message string

info( message )

Shortcut for messages of type "info"

  • message string

error( message )

Shortcut for messages of type "error"

  • message string

debug( message )

Shortcut for messages of type "debug"

  • message string

stats( message )

Shortcut for messages of type "stats"

  • message string

Options

  • options The options object can be passed to the new Logger() constructor.
    • logger - encapsulates all logger configurations
      • types - Message types to process, if they are not specified for individual outputs. This setting is optional. If not given, the fallback is ["error","info"]
      • format - At the moment, the message formatting is limited to either show or hide the date/time and the type indicator. Default: false (meaning hide all)
      • outputs - A list of output files.
        • file - A filename for output. Keyword "stdout" means console output. If you provide the full path, it will be used as given, but directory should already exist. Default: "stdout"
        • types - optional list of types that will be processed for this file. If not given, default_types setting will be used.