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

logulus

v1.0.14

Published

Logulus adds many features to the Winston logging system. It provides advanced logging services for your modules.

Downloads

5

Readme

Logulus

Logulus adds many features to the Winston logging system. It provides advanced logging services for your modules, allows for easy configuration using a JSON file, can log to the console and/or the file system, supports rotating log files, allows for inclusion or exclusion of messages by module and/or level, and provides customizable levels of messaging. Configuration is by hostname, environment variable, or default therefore each PC may have its own configuration.

Features

  • Log to the console, the file system, or both.
  • Provides customizable levels of logging, defaults to debug, info, warn, and error.
  • Configuration via JSON, attempts to load the config in the following order, it stops once one of the methods is successful:
    • Check for a LOGULUS_CONFIG environment variable, if it exists then load the config file indicated by the variable.
    • Check for a configuration file named after the host, if it exists then load it (ex., logulus.myhost.json).
    • Check the package.json version, if it includes -alpha, beta, or -rc then use the included testing.json config found in the application directory.
    • If no config files are found the application defaults to full logging.
  • You can optionally filter module messages based on partial path matching and levels matching (includeFilters, excludeFilters).
  • Messages can optionally include JSON metadata.
  • You can configure the number of log files to save while rotating.
  • You can specify a directory in the file transport config as well (ex., logs).
  • If you specify 0 for saveCount then the file logger will continue to use the same file.

Installation

npm install -g logulus

Usage

Programmatic Interface

You begin by instantiating the module.

    // This allows access to the FileLogger class and the create method.
    var Logulus = require( "logulus" );
    // The create method takes in the current module id.
    var log = Logulus.create(module.id);

    // Basic usage
    log.debug("This is a debug message", {name: "David", age: 46});
    log.error("An error occurred");

Winston can be accessed from the logulus instance:

    // The create method takes in the current module id.
    var log = require("logulus").create(module.id);
    log.winston.remove('console');

Similarly, the active logger can be access as well:

    // The create method takes in the current module id.
    var log = require("logulus").create(module.id);
    var fileLogger = log.logger.transports['logulus-file']; 

Example configuration file

    {
      "baseName": "mylog",
      "transports": [
        {"type":"console", "name":"logulus-console", "colorize": true, "level": "debug", "handleExceptions": true, "silent": false},
        {"type":"file", "name":"logulus-file", "saveCount": 5, "level": "debug", "handleExceptions": true, "silent": false}
      ],
      "includeFilters": [
        {"pattern": "*", "levels": ["debug", "info", "warn", "error"]}
      ],
      "timestampSettings": {"includeDate": true, "includeMilliseconds": true},
      "showModule": true,
      "colors": {
        "debug": "white",
        "info": "blue",
        "warn": "yellow",
        "error": "red"
      },
      "levels": {
        "debug": 0,
        "info": 1,
        "warn": 2,
        "error": 3
      },
      "exitOnError": false
    }

Options

Results take the form of

    2014-09-26 10:02:35.458 - debug: [/logulus/lib/test.js] - Debugging with test
    2014-09-26 10:02:35.460 - debug: [/logulus/lib/test.js] - Executing test

License

MIT