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

@vlalg-nimbus/raven-sentinel

v2.0.5

Published

Raven Sentinel - Log Manager

Downloads

35

Readme

npm npm Snyk Vulnerabilities for npm package Snyk Vulnerabilities for GitHub Repo

This lib is a log manager that facilitates the identification of logs in code.

Logs list

cleanLog

Internally it is an console.log. No styling, i.e. a default console.log

this.$log.cleanLog($log.printObject(data));

debug

Internally it is an console.debug

this.$log.debug('Msg test for debug');

error

In the example the e is passed in the catch, so it could be an error or something else

Internally it is an console.error

this.$log.error(e);

log

Internally it is an console.log

this.$log.log('Hello world')
this.$log.log('Hello world 1', 'Hello world 2')

logDebug

Internally it is an console.log

this.$log.logDebug('Hello world')
this.$log.logDebug('Hello world 1', 'Hello world 2')
this.$log.logDebug(JSON.stringify({algumObj}, null, 2))

logError

Internally it is an console.error

this.$log.logError('this is the error')

logInfo

Internally it is an console.log

this.$log.logInfo('Hello world')
this.$log.logInfo('Hello world 1', 'Hello world 2')

method

Internally it is an console.log

this.$log.method('Hello world')
this.$log.method('Hello world 1', 'Hello world 2')

printObject

Used with the $log.cleanLog

Internally it is an printObject

this.$log.cleanLog(this.$log.printObject({ name: 'test' }));

table

Internally it is an console.table

this.$log.table({ name: 'test' });

time

Starts a timer in the console

Internally it is an console.time

this.$log.time();
for (let i = 0; i < 3; i++) {
    console.log(i)
}
this.$log.timeEnd();

timeEnd

It is used after the logic inserted after $log.time()

Internally it is an console.timeEnd

this.$log.time();
for (let i = 0; i < 3; i++) {
    console.log(i)
}
this.$log.timeEnd();

trace

Internally it is an console.debug

this.$log.trace('Msg test for trace')

warn

Internally it is an console.warn

this.$log.warn('Msg test for warn')

How to use?

To install
npm i @vlalg-nimbus/raven-sentinel

or

yarn add @vlalg-nimbus/raven-sentinel
To use
import LoggerFactory from '@vlalg-nimbus/raven-sentinel'

const nodeEnv = process.env.NODE_ENV
const isDev = !!(nodeEnv === 'development')

const logOptions = {
  className: 'App Name',
  nodeEnv: nodeEnv,
  showLogs: isDev ? 'Trace' : 'Warn'
}

const $log = new LoggerFactory(logOptions).create()

$log.logDebug('Hello world')
CDN

Unpkg

https://unpkg.com/@vlalg-nimbus/raven-sentinel/dist/bundle.min.umd.js

Options

  • showLogs: It serves to inform which log level can appear in the development and production environments. For the previous example we used level 0 (trace) if it is 'development', so all logs are allowed, as it is not safe and correct to be logging in production, we set level 3 (warn), which will log (Warn, Error and None) that is, the levels (3, 4 and 5) in production.

    Trace = '0'
    Debug = '1'
    Info = '2'
    Warn = '3'
    Error = '4'
    None = '5'
  • className: Used to pass the system name, libs and such that are using log-manager. This makes it easier to identify the log, since we can use it in several places, so if we were using it in a service and in the general application, we could set the right name of the service as 'Service X' and inside the application 'Application Y', when you consult the console, everything will be separated.

  • nodeEnv: This field receives the environment that is currently being used, if I am in development development and production production. Then we pass process.env.NODE_ENV or whatever env you are using.

  • primaryColor: Used to pass a hex of some color that will be used as the primary color. The default is the color #04F0FC. The default color is used if none is passed.

  • logStyle: You can pass the style of the log, if you do not inform anything, the default will be used. This would basically be like working with css in console.log.

License

MIT