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

@langurama/log

v1.1.2-rc1

Published

Retardedly basic terminal and file logging for Node.js and the browser.

Downloads

19

Readme

@langurama/log

Build Coverage Version License

Due to the retardedness of some of the libraries not providing a simple human readable logging library, which can log to file and stdout/stderr, I had to tell someone to hold my beer so I could.

Contents.

Install

npm install --save-prod --save-exact @langurama/log

Usage

  • Terminal transport works in both Node.js and the browser.
  • File transport works only in Node.js.

<LanguramaLog>

languramaLog(configuration)

  • configuration <LanguramaConfiguration> | <LanguramaConfiguration[]> Default: LanguramaConfiguration
    • LanguramaConfiguration <LanguramaTerminalConfiguration | LanguramaFileConfiguration> Default: LanguramaTerminalConfiguration
      • LanguramaTerminalConfiguration <Object> Only one per log instance.
        • type <string> Valid values: [terminal] Required
        • level <string> Valid values: [error, warn, info, debug, trace] Default: info
        • callee <boolean> Default: true
        • chalk <Chalk> Display logs in terminal in color using the Chalk module instance.
      • LanguramaFileConfiguration <Object>
        • type <string> Valid values: [file] Required
        • level <string> Valid values: [error, warn, info, debug, trace] Default: info
        • path <string> Path where log should be written to. Default: ./log/application.log
        • json <boolean> Write to log file in JSON format. Default: false
  • Returns: <LanguramaLog>

<LanguramaLog>

error([...messages])

  • messages <string | undefined | null | boolean | number | bigint | Object | Symbol | Error> Writes to stderr.
  • Returns: <undefined>

warn([...message])

  • messages <string | undefined | null | boolean | number | bigint | Object | Symbol | Error> Writes to stderr.
  • Returns: <undefined>

info([...message])

  • messages <string | undefined | null | boolean | number | bigint | Object | Symbol | Error> Writes to stdout.
  • Returns: <undefined>

debug([...message])

  • messages <string | undefined | null | boolean | number | bigint | Object | Symbol | Error> Writes to stdout.
  • Returns: <undefined>

trace([...message])

  • messages <string | undefined | null | boolean | number | bigint | Object | Symbol | Error> Writes to stdout.
  • Returns: <undefined>

Example

You may check the example/ directory for runnable example files.

Example usage:

import { default as languramaLog } from 'log';
import { default as chalk } from 'chalk'; // If you want to have colors in the terminal.

const log = languramaLog([
    {
        type: 'file',
        path: 'log/foo2.log',
        callee: false,
        level: 'error'
    },
    {
        type: 'file',
        path: 'log/foo1.log',
        level: 'warn',
        json: true
    },
    {
        type: 'terminal',
        level: 'debug',
        callee: true,
        chalk
    }
]);

log.info('herro', 1, 3.4, null, undefined, [1, 9], new Error('crap'), true, { wtf: 'k' });
log.error(new Error('F*ck'));
log.warn('This is a warning.');
log.info('God.');
log.debug('k.');
log.trace('This will not be displayed.');

Will result in the following.

Terminal:

2020-05-02 15:24:27 UTC+2   INFO herro 1 3.4 null undefined [1,9] Error: crap
    at Object.<anonymous> (/home/karl/dev/log/example/index.js:73:52)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Module._compile (/home/karl/dev/log/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Object.newLoader [as .js] (/home/karl/dev/log/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at Object.<anonymous> (/home/karl/dev/log/node_modules/@babel/node/lib/_babel-node.js:180:21)
    at Module._compile (internal/modules/cjs/loader.js:955:30) true {
    "wtf": "k"
} /home/karl/dev/log/example/index.js:73:5
2020-05-02 15:24:27 UTC+2  ERROR Error: F*ck
    at Object.<anonymous> (/home/karl/dev/log/example/index.js:74:11)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Module._compile (/home/karl/dev/log/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Object.newLoader [as .js] (/home/karl/dev/log/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at Object.<anonymous> (/home/karl/dev/log/node_modules/@babel/node/lib/_babel-node.js:180:21)
    at Module._compile (internal/modules/cjs/loader.js:955:30) /home/karl/dev/log/example/index.js:74:5
2020-05-02 15:24:27 UTC+2   WARN This is a warning. /home/karl/dev/log/example/index.js:75:5
2020-05-02 15:24:27 UTC+2   INFO God. /home/karl/dev/log/example/index.js:76:5
2020-05-02 15:24:27 UTC+2  DEBUG k. /home/karl/dev/log/example/index.js:77:5

File log/foo1.log:

2020-05-02 15:56:39 UTC+2 ERROR Error: F*ck
    at Object.<anonymous> (/home/karl/dev/log/example/index.js:74:11)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Module._compile (/home/karl/dev/log/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Object.newLoader [as .js] (/home/karl/dev/log/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at Object.<anonymous> (/home/karl/dev/log/node_modules/@babel/node/lib/_babel-node.js:180:21)
    at Module._compile (internal/modules/cjs/loader.js:955:30)

File log/foo2.log:

{"timestamp":"2020-05-02 15:56:39 UTC+2","level":"ERROR","message":"Error: F*ck\n    at Object.<anonymous> (/home/karl/dev/log/example/index.js:74:11)\n    at Module._compile (internal/modules/cjs/loader.js:955:30)\n    at Module._compile (/home/karl/dev/log/node_modules/pirates/lib/index.js:99:24)\n    at Module._extensions..js (internal/modules/cjs/loader.js:991:10)\n    at Object.newLoader [as .js] (/home/karl/dev/log/node_modules/pirates/lib/index.js:104:7)\n    at Module.load (internal/modules/cjs/loader.js:811:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:723:14)\n    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)\n    at Object.<anonymous> (/home/karl/dev/log/node_modules/@babel/node/lib/_babel-node.js:180:21)\n    at Module._compile (internal/modules/cjs/loader.js:955:30)"}
{"timestamp":"2020-05-02 15:56:39 UTC+2","level":"WARN","message":"This is a warning."}

How it works

This package transpiles code to CommonJS via Babel targeted at the current Node.js LTS version. To use this in the browser you will need to transpile it from CommonJS to your targeted browser(s).