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

log-management

v2.1.0

Published

module that completely manages the log process for an app

Downloads

6

Readme

Log Management

The Application was created to manage the logging process. This application handles the logging to the console in different colors to easily tell the difference between informational messages, warning messages, and errors.

The application has the ability to create log files in a /.log folder. These files will have the type 'information, warning, and error` with the date it was created in the following format:

`error_log_MM-DD-YYYY`
`warning-DD-YYYY`
`error_log_MM-DD-YYYY`

The application has the ability to remove old log files. Meaning you don't have to review the log folder to remove old files. You can set the days you want to keep files in the folder and the application removes any older files daily.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

A step by step series of examples that tell you how to get a development env running

Install the app from NPM:

npm install log-management --save

examples

Setting the Configuration

To change the application's default settings use the following:

const log = require('log-management')

log.setConfig({options})

The options available for the above settings are as follows:

The option stdMode controls if the message that was passed along to create the log file is also printed in the console/screen.

If true then the messages are printed to the console/screen as well as the log file.

If false{default} then no message is printed out to the console/screen, but still added to the log file.

The option working controls if the auto remove log files is turned on or off.

If true then the auto remove log files is turned on and the 'logDays` option should be set if not the default wil be set.

If false{default} then the auto remove log files is turned off.

The option logDays controls how long the files are to remain in the ./log folder. If no number is entered the default is 90 days if the working option is true and default is 0 if the working option is false.

const options = {
    stdMode: boolean, // default false
    working: boolean, // default false
    logDays: number   // default 0        
}

How to create logs

Creating logs are easy just follow the explains provided below:

For Error Use:

log.errorFile(data)

For Warning Use:

log.warningFile(data)

For Info Use:

log.infoFile(data)

Please be aware that data can be a string, number, object, or array. Since sometimes we need that data to be able to research an issue.

How to print to the console/screen

Creating logs are easy just follow the explains provided below:

For Error Use:

log.error(data)

For Warning Use:

log.warning(data)

For Info Use:

log.info(data)

Please be aware that data can be a string, number, object, or array. The function will JSON Stringify anything not a string

Videos

  • [YouTube] Testing Video Coming Soon

Authors