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

node_smart_logger

v4.0.4

Published

<br/>

Downloads

465

Readme

Node Smart Logger

A library that allows you to keep better control of your daily logs in Node

Install

npm i node_smart_logger

Start it

import { SmartLogger } from 'node_smart_logger';

const _logger = new SmartLogger();

By default logger will create a logs folder in the root of your project, but you can also indicate the path and name of the logs folder when you initialize it:

const config = {
    logs_folder_path: "./someDir/anotherDir",
    logs_folder_name: "anotherLogsFolderName"
}
const _logger = new SmartLogger(config);

Opciones de Configuración:

  • logs_folder_path : String - [Ruta donde se generará el archivo de logs] [defaul: "./"]
  • logs_folder_name : String - [Nombre del directorio donde se guardaran los logs] [default: "logs"]
  • show_terminal : Boolean - [Habilita o inhabilita mostrar logs en el terminal] [default: "true"]
  • write_file : Boolean - [Habilita o inhabilita escribir los logs en el archivo] [default: "true"]

Disable logs for terminal during test, set environment variable

SET TEST_LOGS=false

logs

These logs are saved to a file in your directory

// normal log
_logger.setLog("message");
_logger.terminalLog("message");// only terminal output
//2022-5-28 9:21:6 | message | {}

// Info log
_logger.setInfo("message");
_logger.terminalInfo("message");// only terminal output
//2022-5-28 9:21:6 | INFO | message | {}

// Error log
_logger.setError("message");
_logger.terminalError("message");// only terminal output
//2022-5-28 9:21:6 | ERROR | message | {}

// Alert log
_logger.setAlert("message");
_logger.terminalAlert("message");// only terminal output
//2022-5-28 9:21:6 | ALERT | message | {}

// Debug log
_logger.setDebug("message");
_logger.terminalDebug("message");// only terminal output
//2022-5-28 9:21:6 | DEBUG | message | {}

// Critical log
_logger.setCritical("message");
_logger.terminalCritical("message");// only terminal output
//2022-5-28 9:21:6 | CRITICAL | message | {}

// Warning log
_logger.setWarning("message");
_logger.terminalWarning("message");// only terminal output
//2022-5-28 9:21:6 | WARNING | message | {}

// Success log
_logger.setSuccess("message");
_logger.terminalSuccess("message");// only terminal output
//2022-5-28 9:21:6 | SUCCESS | message | {}

// Trace log [return a trace of route]
_logger.setTrace("message");
_logger.terminalTrace("message");// only terminal output
//2022-5-28 9:21:6 | TRACE | message | {}
/*
    myOtherFUnction
    myFunction
    onclick
*/

Logs agree to receive a data object


const dataToLog = {
    error: false,
    message: 'some message'
}

_logger.setCritical("log message", dataToLog);
//2022-5-28 9:21:6 | critical  | log message | {"error":false,"message":"some message"}

Logs only for terminal

Steep

_logger.setSteep({message: 'some message',number: 5});
//[ steep 5 ] :::: some message

Cantity

_logger.setCantity({message: 'Total Records', total: 100});
//Total Records [100]

Interval

_logger.setInterval({message: 'Record Processed', actual: 5, total: 100});
//Record Processed [5] of [100]

You can create titles with background according to the level of the log

Title

_logger.setTitle({message: "This is a error tittle", level: "error"});

Title levels available