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

@surajs02/logdash

v1.0.10

Published

Simple and customizable log functions that can integrate with lodash.

Readme

logdash

Simple and customizable log functions that can integrate with lodash.

Features

  • 5 pre-defined log functions:
    • logn: Prints uncolored [NONE] tag via console.log
    • logi: Prints blue [INFO] tag via console.info
    • logs: Prints green [SUCCESS] tag via console.log
    • logw: Prints orange [WARN] tag via console.warn
    • loge: Prints red [ERROR] tag via console.error
  • Add and customize logs by color, console, tag, and more
  • Use log functions directly or easily integrate for lodash chain logging
  • Toggle log functions on/off
  • Helper functions for easily mapping over and customizing log type objects

Install

npm install @surajs02/logdash

Basic Usage

All log functions can be used directly (i.e., without lodash integration)

import { loadLogdash } from '@surajs02/logdash'; // TypeScript
// const { loadLogdash } = require('logdash'); // JavaScript.

const { logn, logi, logs, logw, loge } = loadLogdash().logFuncs;

logn('A standard log');
logi('This might be useful');
logs('That went well');
logw('There may be a problem...');
loge('There was an error');

The above logs would be styled and displayed with a colored tag:

all-logs

All log functions support multiple arguments:

logn('String1', 1, true, [1], { a: 1 }, null, undefined);

Integrating with lodash

Pass a lodash instance as a lodashForMixin option to make log functions available via lodash:

const _ = require('lodash');

loadLogdash({ lodashForMixin: _, });

_.logn('Logging directly via logdash');

Log functions can be used indirectly in lodash chains:

const doubled = _.chain([1, 2, 3])
    .logi() // Prints [1, 2, 3].
    .map(n => n * 2)
    .logi() // Prints [2, 4, 8].
    .value();

_.logi(doubled.length); // Prints 3.

Customization

All log functions are enabled by default but can be disabled via the disableAllLogs option:

const { logi } = loadLogdash({ disableAllLogs: true, }).logFuncs;
_.logi("This won't be printed");

Log types are customized via the customizeLogTypes option, which is a function that accepts a ILogTypeMap to return a new ILogTypeMap:

interface ILogTypeMap {
    [key: string]: ILogType;
}

ILogTypeMap maps log type names to ILogType values:

interface ILogType {
    color?: Function;
    consoleType?: Function;
    tag?: String;
    func?: ILogFunc;
    enabled?: boolean; 
}

New log types can be added and accessed via log<initial-letter-of-log-type>:

const { loga } = loadLogdash({
    customizeLogTypes: (logTypes: ILogTypeMap) => ({
        ...logTypes,
        added: { color: chalk.cyan }, // `added` will become `loga`.
    }),
}).logFuncs;
loga('This will print in cyan!');

Existing log types can be customized easily via the mapObjValues helper:

import { loadLogdash, mapObjValues, ILogType } from '@surajs02/logdash';
const { logi } = loadLogdash({
    customizeLogTypes: (logTypes: ILogTypeMap) => mapObjValues(
        logTypes, (t: ILogType) => ({...logTypes, color: chalk.magenta }),
    }),
}).logFuncs;
logi('This and other log functions will now print in magenta!');

Testing

Setup

git clone https://github.com/surajs02/logdash.git && cd logdash && npm install

Run all tests

npm run test

Test only log functions

npm run testLogFuncs

Test only logdash options (e.g., lodash integration)

npm run testOptions