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

proxey-ilogger

v0.2.0

Published

A logging-library for node.js

Downloads

3

Readme

travis

proxey-ilogger

a logging library for node.js

Getting started

npm install proxey-ilogger

const ilogger = require('proxey-ilogger');

##API

###Create a new logger instance You can get a new logger instance by one of the three following ways:

const ilogger = require('proxey-ilogger');
const logger = new ilogger();
const ilogger = require('proxey-ilogger');
const logger = ilogger();
const ilogger = require('proxey-ilogger');
const logger = ilogger.getLogger();

You can also pass a string to each of these 3 methods. This string will then appear in each log line. This comes in handy if you have more than one logging instances in multiple files.

const ilogger = require('proxey-ilogger');
const logger = new ilogger('Service XY');

###Configuration

####ilogger.setConsoleOutput(Boolean) default: true Enable or disable logging to the console. This affects all existing and future logger instances.

####ilogger.setFileOutput(Boolean) default: false Enable or disable logging to a file. you also have to set the filename for this to work. This affects all existing and future logger instances.

####ilogger.setFilename(String) default: null Sets the filename for logging to a file. You also have to enable file logging. This affects all existing and future logger instances.

####ilogger.setLevel(Level) default: Level.INFO Sets the log level. Must be an instance of ilogger.Level. The default-level is INFO. This affects all existing and future logger instances.

####ilogger.setMillis(Number) default: null Set the timestamp which used for creating the datetime in each log-line. If it's set to null it will use the current datetime. This is probably only useful for tests.

available levels:

const ilogger = require('ilogger');
ilogger.setLevel(ilogger.Level.ALL)
ilogger.setLevel(ilogger.Level.DEBUG)
ilogger.setLevel(ilogger.Level.INFO)
ilogger.setLevel(ilogger.Level.WARN)
ilogger.setLevel(ilogger.Level.ERROR)
ilogger.setLevel(ilogger.Level.FATAL)

##Examples

###Two files with each one logging instance To keep track of where your log lines come from, you can pass e.g the name of a file to the constructor of the logging instance.

File1:

const ilogger = require('ilogger');
const logger = new ilogger('File1');
logger.info("this is file1");

File2:

const ilogger = require('ilogger');
const logger = new ilogger('File2');
logger.info("this is not file1");

If you run your application, ilogger will output something like this:

2016-06-15 22:07:01,640 INFO  [File1] this is file1
2016-06-15 22:07:01,649 INFO  [File2] this is not file1