0.1.3 • Published 6 years ago

cat2log v0.1.3

Weekly downloads
3
License
MIT
Repository
-
Last release
6 years ago

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);

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago