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

logish

v1.0.14

Published

Lightweight logging and debug-logging utility for Node.

Downloads

67

Readme

Logish

Node.js CI CodeQL npm version

  • Node Version Greater Than or Equal To node 16

Logish is designed to be lightweight, simple and configurable.

Logish is an EventEmitter logging object that triggers a LogEvent on an entry, allowing for customized handling. Designed with LogEvent in mind, the intention was to allow developers to hook into the event to route log messages to a centralized location (such as a database) or specifically route error and fatal log events to monitoring or alerting services such as Slack, Discord, or PagerDuty.

I'm an experienced developer, with DevOps and Operations SRE experience. The purpose of this project is to create a logging system that maintains small log files in a pod (or absolutly no logs in serverless functions), intended to be configured and developed in an app for centralized logging AND app debugging. Thinking of datadog, elastic, cloudwatch or other implementations.

This should be designed through the log.on() log event EventEmitter and a Logish production configuration. Examples and documentation to come. Any Logish speed improvements are welcome.

npm i logish

Default Configuration

This configuration represents the complete default Logish configuration.

const defaultLogishConfig = {
    level : 'trace',
    performanceTime : true,
    controllers : [
        {
            name: 'console',
            active: true,
            displayOnlyEnvNamespace: false,
            displayLevels : ['trace', 'debug', 'info', 'warn', 'error', 'fatal'],
            format : '%datetime %level %namespace %entry %performance',
            useColor: true,
            colors : {
                trace   : '\x1b[32m',    debug   : '\x1b[36m',
                info    : '\x1b[37m',    warn    : '\x1b[33m',
                error   : '\x1b[35m',    fatal   : '\x1b[31m',
                reset   : '\x1b[0m'
            }
        },
        {
            name: 'file',
            active: true,
            files: [
                {
                    title: 'application',
                    active : true,
                    writeLevels: ['info', 'warn'],
                    format : '[%datetime %level] %namespace %host - %entry %performance',
                    filename: 'logs/app.log',   
                    maxsize_in_mb: 2,
                    backups_kept: 2, 
                    gzip_backups : false
                },
                {
                    title: 'errors',
                    active : true,
                    writeLevels: ['error', 'fatal'],
                    format : '[%datetime %level] %namespace %host - %entry %performance',
                    filename: 'logs/errors.log',   
                    maxsize_in_mb: 2,
                    backups_kept: 2, 
                    gzip_backups : false
                },
                {
                    title: 'development',
                    active : true,
                    writeLevels: ['trace', 'debug'],
                    format : '[%datetime %level] %namespace %host - %entry %performance',
                    filename: 'logs/dev.log',   
                    maxsize_in_mb: 2,
                    backups_kept: 2, 
                    gzip_backups : false
                }
            ]
        }
    ]
}

Basic Example

Register an event function to execute special instructions on every log entry.


// import ES6
import { Logish } from 'logish'

// load Logish object custom config values.
const log = new Logish(logishConfig)

// or use all defaults by passing no args
const logish = new Logish()

// set namespace for module
log.setNamespace('mod:index')

// Register a listener - listens for and triggers on a log event.
log.on('LogEvent', (logEntry) => {
    
    // send this type of logEntry to discord
    if (logEntry.level === 'FATAL' || logEntry.level === 'ERROR') {
        // send to Discord   
    }

    // send to MongoDB

    console.dir(logEntry)
    // output
    //   logEntry =  {
    //   level: 'debug',
    //   envVars: undefined,
    //   hostname: 'A074709-B957',
    //   message: 'this is the log message',
    //   namespace: 'example:index',
    //   datetime: { timestamp: 1660130422813, dateString: '2022-08-10 11:20:22' },
    //   performance: '0.28(ms)',
    //   entries: [
    //     {
    //       console: '2022-08-10 11:20:22 DEBUG example:index this is the log message 1.18(ms)'
    //     },
    //     {
    //       file_development: '[2022-08-10 11:20:22 DEBUG] A074709-B957 example:index | this is the log message 1.18(ms)\n'
    //     }
    //   ],
    //   data: undefined
}
})

const errorMsg = 'Something bad happened'
const sendThisToo = { byte: 1000000, kilobyte: 1000, megabyte: 1}

// Send multiple arguments, including a callback function.
log.error ('Blowup message', errorMsg, sendThisToo, (logEntry) => {
    console.log ('Inside a callback - who knows why?')
})

// Send a simple info() log entry.
log.trace('constructor()')
log.debug('connStr', connectionString)
log.info('Mongoose connected to MongoDB successfully. Nice job!')
log.error('MongoDB connection failed!', errorObject)
log.trace('END constructor()') 
// output will show time difference between trace calls IF "performanceTime : true"

LOGISH Process Variables

Run with command line environment variables.

LOGISH=index,mod:* node index.js

Launch with environment variables and set 'displayOnlyEnvNamespace: true' in the configuration to only log specific entries to console.

This example will log all 'index' namespace entries, and all namespaces with mod:*.

file1.js log.setNamespace('mod:file1')
file2.js log.setNamespace('mod:file2')

Levels

Introducing standard logging levels, but not necessarily limited to. Give me a reason to extend this...

  • TRACE - Intended for code tracing, not stack tracing. (function start & function end as an example)
  • DEBUG - Always need to examine values.
  • INFO - Standard entry.
  • WARN - Something is up, but not going to interupt flow.
  • ERROR - Something happend and it will most likly screw something else up.
  • FATAL - Something happened, and we need to alert the admins and shut down.

Public Methods

  • getLevel()
  • setLevel(value)
  • getNamespace()
  • setNamespace(value)
  • getConfig()
  • setConfig(value)
  • getStats()

Contributing

Always welcome people willing to contribute. Please read the Open Source Guide. There is so much to be contributed to any project and should you choose to controbute to this project, that would be amazing. We do adhere to a (code of condeuct) and we do implement a workflow process.