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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@micromint1npm/quos-est-inventore

v1.0.0

Published

<h3 align="center" > <a href="https://github.com/micromint1npm/quos-est-inventore"><img alt="Source: Github" src="https://img.shields.io/badge/source-github-brightgreen?style=for-the-badge&logo=github&labelColor=%23505050"></a> <a href="https://github

Downloads

2

Readme

About @micromint1npm/quos-est-inventore

@micromint1npm/quos-est-inventore is a simple but flexible console logging library written in JavaScript with no dependencies. @micromint1npm/quos-est-inventore comes with common-sense builtin functions and defaults, and works right out of the box.

The package provides you with functions logm(), infom() and timem() to log messages to the console with standard formatting, as well as functions errm(), warnm() and throwm() for error handling. Also included is printm(), a simple wrapper for console.log() that returns an array of the arguments it's given.

Install

Install @micromint1npm/quos-est-inventore via NPM:

$ npm i @micromint1npm/quos-est-inventore

Basic Usage

Import:

Import the library in your code:

import @micromint1npm/quos-est-inventore from "@micromint1npm/quos-est-inventore";
//  or
import { logm, errm, warnm, infom, timem, printm, throwm } from "@micromint1npm/quos-est-inventore";

@micromint1npm/quos-est-inventore must be imported as an ES6 module.

Logging:

To log to the console:

import lm from "@micromint1npm/quos-est-inventore";

lm.logm("This is a log message");
lm.errm("Failed to connect to server");
lm.warnm("Request for /:user failed without authorization");
lm.infom("Server listening on port 3000");
lm.timem("Received a GET request for /");
lm.printm("A regular console.log() statement");
lm.throwm("Invalid configuration file");
Output:
LOGM: This is a log message
ERRM: Failed to connect to server
WARNM: Request for /:user failed without authorization
INFOM: Server listening on port 3000
12/31/1999, 12:35:00 PM: Received a GET request for /
A regular console.log() statement
THROWM: Invalid configuration file
<stackTrace>
        throw new Error(`${toString(errPrefix, errSeparator)} ${checkObject(errMessage)}`);
              ^
Error: THROWM: Invalid configuration file
    at <stackTrace>

Configuration

If dotenv is installed in the project, message defaults can be configured using a .env file:

### Prefix abbreviation
### (leave commented to not print a prefix abbreviation)
PREFIX_ABR = "APP"

### Separator between abbreviation and prefix
### (leave commented to use the default separator)
PREFIX_SEPARATOR = "-"

### Default message type prefixes
### (leave commented to use the default prefixes)
LOGM_PREFIX   = "LOG"
ERRM_PREFIX   = "ERROR"
THROWM_PREFIX = "ERROR-THROWN"
WARNM_PREFIX  = "WARNING"
INFOM_PREFIX  = "INFORMATION"

### Default separator between the prefix and message
### (leave commented to use the default separator)
MESSAGE_SEPARATOR = " ::"

### Default text for undefined messages
### (leave commented to use the default text)
LOG_MESSAGE   = "a new message was logged"
ERROR_MESSAGE = "a new error has occurred"
WARN_MESSAGE  = "a new warning was logged"

### Time message locale
### (leave commented to use "en-US")
### ex.: "en-US", "en-GB", "ko-KR", "ar-EG", "ja-JP-u-ca-japanese", etc.
TIMEM_LOCALE = "en-GB"

If dotenv is not installed, @micromint1npm/quos-est-inventore will use the builtin defaults.

Documentation

logm()

Log a message to the console.

Parameters

  • message any — the message content. (optional, default null)
  • prefix string — the message prefix text. (optional, default null)
  • separator string — the separator string between the prefix and message text. (optional, default null)

Examples

Code:
logm("logged message", "LOG", " |");
Output:
LOG | logged message

Returns string — the full message string as {prefix}{separator} {message}.


errm()

Log an error to the console with the desired message.

Parameters

  • message any — the error message content. (optional, default null)
  • err Error — a target error to print to print. (optional, default null)
  • prefix string — the error message prefix text. (optional, default null)
  • separator string — the separator string between the prefix and error message text. (optional, default null)

Examples

Code:
errm("error message", new Error("error text"), "ERROR", " |");
Output:
ERROR | error message 
 Error: error text
    at <stackTrace>

Returns string — the full error message string as {prefix}{separator} {message}.


warnm()

Log a warning message/error to the console with the desired message.

Parameters

  • message any — the warning message content. (optional, default null)
  • err Error — a target error to print. (optional, default null)
  • separator string — the separator string between the prefix and warning message text. (optional, default null)

Examples

Code:
warnm("warning message", new Error("error text"), " |");
Output:
WARNM | warning message 
 Error: error text
    at <stackTrace>

Returns string — the full warning message string as {prefix}{separator} {message}.


infom()

Log an info message/error to the console with the desired message.

Parameters

  • message any — the info message content. (optional, default null)
  • err Error — a target error to print. (optional, default null)
  • separator string — the separator string between the prefix and info message text. (optional, default null)

Examples

Code:
infom("information message", undefined, " |");
Output:
INFOM | information message

Returns string — the full info message string as {prefix}{separator} {message}.


timem()

Log a message/error to the console with the desired message and the current time.

Parameters

  • message any — the message content. (optional, default null)
  • err Error — a target error to print. (optional, default null)
  • separator string — the separator string between the prefix and message text. (optional, default null)

Examples

Code:
timem("time-logged message", undefined, " |");
Output:
12/31/1999, 12:35:00 PM | time-logged message

Returns string — the full message string as {prefix}{separator} {message}.


printm()

Print a message to the console (wrapper for console.log()).

Parameters

  • message any — the message content.
  • optionalParams ...any — additional values or objects for output.

Examples

Code:
printm("printed message", "& additional output");
Output:
printed message & additional output

Returns Array — an array of the arguments passed.


throwm()

Throw an error with the desired message.

Parameters

  • message any — the error message content. (optional, default null)
  • err Error — a target error to print. (optional, default null)
  • prefix string — the error message prefix text. (optional, default null)
  • separator string — the separator string between the prefix and error message text. (optional, default null)

Examples

Code:
throwm("thrown error message", new Error("error text"), "ERROR", " |");
Output:
ERROR | thrown error message
<stackTrace>
throwm("thrown error message", new Error("error text"), "ERROR", " |");
                               ^
Error: error text
    at <stackTrace>

Returns string — the full error message string as {prefix}{separator} {message}.