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

kdts-simple-logger

v0.0.9

Published

A very simple and compact logging tool

Downloads

49

Readme

kdts-simple-logger

A very compact logging and debugging package

Installation

$ npm install kdts-simple-logger

Usage

Debugger - standalone

// use only the debugger 
const debug = require('kdts-simple-logger').kdtsDebug;


/**
 * Debug your code
 *
 * In order to see you debug outputs, you need to insert "DEBUG=*" 
 * or at least "DEBUG=your_package_name:*" into to the script part of your package.json file
 * 
 * i.e.:
 * 	"scripts": {
 * 		...
 * 		"start:debug": "clear && NODE_ENV=development LOG_LEVEL= DEBUG=* node server.js",
 * 		...
 *	}
 */
 
debug.info('Some debug info message')
debug.warn('Some debug warning message')
debug.error('Some debug error message')

Optional step for the logger and morganLogger

The logger and morganLogger accept and object as argument which provide the path to an existing directory where logfiles can be stored

/**
 * Making sure the log-directory exists
 */
const fs = require('fs')
const path = require('path');
const logDirectory = path.join(__dirname, '../log');

// ensure the log directory exists
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory);

const opt = {
    pathToLogDir: logDirectory
};

Logger - standalone

// without any argument
const log1 = require('kdts-simple-logger').kdtsLog()

// with an argument (of type object as defined above) specifying the path to the directory where the the log can be stored
const log1 = require('kdts-simple-logger').kdtsLog(opt)


log1.silly('Some silly log...');
log1.debug('Some debug log...');
log1.verbose('Some verbose log...');
log1.info('Some info log...');
log1.warn('Some warning log...');
log1.error('Some error log...');

// alternative logging 
log1.log('silly', 'Some silly log...');
log1.log('debug', 'Some debug log...');
log1.log('verbose', 'Some verbose log...');
log1.log('info', 'Some info log...');
log1.log('warn', 'Some warning log...');
log1.log('error', 'Some error log...');

MorganLogger - standalone

// without any argument: defaults to process.stdout and process.stderr
const log2 = require('kdts-simple-logger').kdtsMorgan()

// with an argument (of type object as defined above) specifying the path to the directory where the the log can be stored
const log2 = require('kdts-simple-logger').kdtsMorgan(opt)

// Middleware HTTP request logger using morgen under the hood
app.use(log2.morganAccessLogger);
app.use(log2.morganErrorLogger);

All at once

// without any argument
const kdtsSimpleLogger = require('kdts-simple-logger').simpleLogger();

// with an argument (of type object as defined above) specifying the path to the directory where the the log can be stored
const kdtsSimpleLogger = require('kdts-simple-logger').simpleLogger(opt);


const debug = kdtsSimpleLogger.debug;
const log1 = kdtsSimpleLogger.log;
const morganAccessLogger = kdtsSimpleLogger.morganAccessLogger;
const morganErrorLogger = kdtsSimpleLogger.morganErrorLogger;

// use them now as defined above...

Deprecated

  • Defining the path to a log dir is now optional and can be left out
const options = {
    pathToLogDir: logDirectory
};

const kdtsSimpleLogger = require('kdts-simple-logger').simpleLogger(options);
  • Misspelled morgenAccessLogger -> is now -> morganAccessLogger

  • Misspelled morgenErrorLogger -> is now -> morganErrorLogger