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

firedev-logger

v18.0.8

Published

isomorphic logger for browser/server in typescript

Downloads

403

Readme

firedev-logger (ng2-logger)

  • Part of firedev.io
  • Isomorphic Logger for TypeScript and JavaScript apps.
  • Purpose:
    • usefull/elegant backend/frontend logger

You can use this logger in your apps with any TS/JS framework.

See what is going on in your app!

Now chrome console logs are full of colors!

Modules marked

See nice server logs:

Modules marked

To install package run:

npm install ng2-logger --save

First import proper version for your environment:

Nodejs server (or any firedev's lib/app):


import { Log, Level } from  'ng2-logger'

or Browser:


import { Log, Level } from  'ng2-logger/browser'  // new javascript module: es2015 + esnext + angular ivy support

Simple use:

In your file with log:


const  log  =  Log.create('books');

or if you wanna just log errors and warnings :


const  log  =  Log.create('books', Level.ERROR, Level.WARN);

'books' is current class or anything inside .ts/.js file.

You can also assign static color to specific module in application (browser for now only):


log.color  =  'red';

After inited log you are able to start debugging:


log.d('object',obj) // console.log

log.er('object',obj) // console.error

log.i('object',obj) // console.info

log.w('object',obj) // console.warn

or


log.debug('object',obj) // console.log

log.error('object',obj) // console.error

log.info('object',obj) // console.info

log.warn('object',obj) // console.warn

Production mode


You will not see anyting in prduction mode:

// enable production mode in your app

...

Log.setProductionMode();

...

// your app code with console and ng2-logger logs

It is important to set production mode before any log messages are executed.

This will ensure that log messages that should not be seen are leaked out.

Selective debug - global settings


Optional specify what you wanna see in yours debug console.

This settings will override settings from files.


Log.setProductionMode();

Log.onlyModules('src:books', 'src:records', 'src:page:login');

Log.onlyLevel(Level.ERROR,Level.INFO);

Specifying onlyModules as regular expression(s)


In the above example you'll notice module:books and module:records were specified.

you might be using such syntax for namespace hierarchy etc. You may also pass in one or more regular

expression string(s) to the onlyModule function to specify a selection of modules you wish

to show, for instances those whose name begins with src:


  

Log.onlyModules( new  RegEx('^.src') );