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

prod-logger

v2.2.13

Published

FR: Module de gestion des logs en fonction du niveau a afficher ansie que d'un booléan pour determiner si on afficher les niveaux superieur ou non. EN: Log management module according to the level to be displayed as well as a boolean to determine whether

Downloads

1

Readme

prod-logger

Coverage Badge CodeQL


This is a log management module

the log management module can take as a parameter

  • a log level
  • a boolean

Try it


Authorized log level

TRACE = Display the execution stack in the console. The stack is more simply the chaining of calls via the various functions.

INFO = Displays an information message in the browser console. a small i icon appears in front of the message.

DEBUG = Displays a message in the web console, with the log level "debug". The message is displayed only if the console is configured to display debug-type messages.

WARN = Displays a warning message in the web console.

ERROR = Displays an error message in the browser console.TRACE = Affiche la pile d'exécution dans la console. La pile est plus simplement l'enchaînement des appels via les différentes fonctions.

INFO = Affiche un message d'information dans la console du navigateur. une petite icône i apparaît devant le message.

DEBUG = Affiche un message dans la console Web, avec le niveau de journal "debug". Le message s'affiche uniquement si la console est configurée pour afficher des messages de type débogage.

WARN = Affiche un message d'avertissement dans la console Web.

ERREUR = Affiche un message d'erreur dans la console du navigateur.


Start by building your logger

   import { logger } from "prod-logger";
   // setup config
   logger.setup(level, seeUpperLevel);

level = Corresponds to log level ('trace','info','debug','warn','error') seeUpperLevel = Boolean if true displays the upper logs otherwise only displays the logs of the same level :warning: the default value is false :warning:


To use the logger

First example where the configuration is: logger.setup('warn', false);

   import { logger } from "prod-logger";
   // setup config
   // level = warn
   // seeUpperLevel = false
   logger.setup(level, seeUpperLevel);

    logger.trace("this is log trace simple");
    logger.info("this is log info simple");
    logger.debug("this is log debug simple");
    logger.warn("this is log warn simple");
    logger.error("this is log error simple");

---
    // output //
     [ Thu, 23 Sep 2021 16:21:25 GMT | TYPE: WARN ] => "this is log warn simple"
---

Second example where the configuration is: logger.setup('warn', true);

   import { logger } from "prod-logger";
   // setup config
   // level = warn
   // seeUpperLevel = true
   logger.setup(level, seeUpperLevel);

    logger.trace("this is log trace simple");
    logger.info("this is log info simple");
    logger.debug("this is log debug simple");
    logger.warn("this is log warn simple");
    logger.error("this is log error simple");

---
   // output //
     [ Thu, 23 Sep 2021 16:21:25 GMT | TYPE: WARN ] => "this is log warn simple"
     [ Thu, 23 Sep 2021 16:21:25 GMT | TYPE: ERROR ] => "this is log error simple"
---

Depending on your configuration, the higher logs will be displayed or not


:warning: the arguments passed to the logger (trace, info, debug, warn, error) will all be stringify in order to have perfect readability

   import { logger } from "prod-logger";
   // setup config
   // level = info
   // seeUpperLevel = false
   logger.setup(level, seeUpperLevel);

    logger.info(
        "this is a complex array ",
        { id: 1, str: "content object" },
        [
            "and another array",
            {
                id: 2,
                str: "object ",
            },
        ]
    );
---
   // output //
     [ Thu, 23 Sep 2021 16:21:25 GMT | TYPE: INFO ] =>  this is a complex array  [{"id":1,"str":"content object"}][["and another array",{"id":2,"str":"whit object ^^"}]]
---

CHANGELOG