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

cat2log

v0.1.3

Published

Easy-to-user log file package

Downloads

8

Readme

pipeline status coverage report

cat2log

cat2log is a easy-to-user and user-friendly npm package, for managing log file

var cat2log = require('cat2log');

Callback | Return

all cat2log function handle callback that return a boolean result:

var cat2log = require('cat2log');

cat2log.all.add(TAG, STATUS, INFO, function (result) {
  if (result) {
    // log successfully written
  } else {
    // log didn't written
  }
});

Available Status

If you want to use your own status or status that is not handle please use this:

var cat2log = require('cat2log');

cat2log.config.use_unknown_status = true;

You can also override all the status with yours, just by giving an JSON Array

var cat2log = require('cat2log');
const custom_status = ['status1', 'status2', 'status3', ... ]
cat2log.config.status = custom_status;

Here the list of handle status:

  1. Unknown
  2. Resuming
  3. Pause
  4. Up
  5. Down
  6. Broken
  7. Warning
  8. OK
  9. Connected
  10. Disconnected
  11. info
  12. Stop
  13. Start

Configuration

Here the default value when you initialize cat2log

{
  path_default: "../../",
  path_md:      "../../",
  path_txt:     "../../",
  path_json:    "../../",

  name_file_default:  "default.log",
  name_file_md:       "default.log.md",
  name_file_txt:      "default.log",
  name_file_json:     "default.log.json",

  date: true,
  local_time: "en-US",
  use_unknown_status: false,

  status: ['Unknown', 'Resuming', 'Pause', 'Up', 'Down', 'Broken', 'Warning', 'OK', 'Connected', 'Disconnected', 'info', 'Stop', 'Start']
}

You can override any config just by giving the name of the config and the value:

var cat2log = require('cat2log');
cat2log.config.path_default = "/var/log/";
cat2log.config.name_file_default = "my-super-log-file.log";
...

ALL Method

cat2log.txt.add(TAG, STATUS, info, callback);

this function add in 'txt', 'md', and 'json' method

TXT Method

cat2log.txt.add(TAG, STATUS, info, callback);

MD Method

cat2log.md.add(TAG, STATUS, info, callback);

JSON Method

cat2log.json.add(object, callback);