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

round-logger

v1.0.4

Published

A rotative file logger for NodeJS based on winston logger.

Downloads

16

Readme

round-logger

NPM

A simple rotative logger for Node.js, based on the great packages winston and winston-daily-rotate-file.

Ready-to-Go. These packages are very powerful and rich of potentialities but their configuration takes some time. Therefore, I built a pre-configured rotative logger ready to be used! It offers a lot of possibilities to configure the logging behaviour, however the only required option is the absolute path of the logging files.

Automatic directories. By default, the log files are stored in different directories by year-month (named with the pattern "yyyy-mm"). A big problem for winston-daily-rotate-file is that it does not create automatically the directories when they do not exist. My solution provides the automatic creation of the directories which not exists.

Set the logger in your project

const LoggerFactory = require('round-logger');

const Logger = LoggerFactory.create({
    enabled:true,
    directory_logs_abs_path:__dirname+'/my-logs', //absolute path needed
});

// Set your own global Logger object...
global.Logger = Logger;

//...or replace the global console object
global.console = Logger

How it works

  • 'my-logs' is the general directory of log files
  • every month will be created a new directory named 'yyyy-mm'
  • every log file is about one day and it will be named 'yyyy-mm-dd-type.log'
  • when the log file exceeds the max_file_size another file is created
my-logs
├── 2017-11
│   ├── 2017-11-29-error.log
│   ├── 2017-11-29-log.log
│   ├── 2017-11-30-error.log
│   └── 2017-11-30-log.log
└── 2017-12
    ├── 2017-12-01-error.log
    ├── 2017-12-01-log.log
    ├── 2017-12-01-error.log.1
    ├── 2017-12-01-log.log.1
    ├── 2017-12-01-error.log.2
    ├── 2017-12-01-log.log.2
    ├── 2017-12-02-error.log
    └── 2017-12-02-log.log

Configuration

  • directory_logs_abs_path: (default: '' / REQUIRED) Absolute path of logs directory. The directory where all logs files and directories are stored. Hint: use the global string __directory.
  • enabled: (default: true) Enable logging
  • console_log_level: (default: 'log') Minimum log level for console logging
  • file_log_level: (default: 'log') Minimum log level for file logging
  • console_logging: (default: true) Enable logging on console
  • file_logging: (default: true) Enable logging on file
  • directory_date_pattern: (default 'yyyy-MM') Pattern for directory names.
  • file_date_pattern: (default: 'yyyy-MM-dd-') Pattern for file names.
  • max_file_size: (default: 1000000) Max file size (Byte).
  • max_files: (default: 10) Max number of log files per day.
  • file_global_log: (default: 'log.log') Global log file name; the global log is a file with all log levels.
  • file_error_log: (default: 'error.log') Error log file name; the error log is a file with error level only.

Bugs or requests

I am still working on this project. So, please, report me any kind of bug or requests about new features. You can do it on GitHub Issues or via email. I will try to solve each issues in a reasonable time.

Next changes

  • Mocha tests
  • Browser version