easy-stat

0.2.2 • Public • Published

About

this is a tiny tool for recording and writing some statistic data to log files.

Usage

npm install easy-stat --save

// 'demo' is the name for identifying from different instances of EasyStat;

var opt = {
  interval: 10000,  // interval value in 'ms' for writing data to log file
  logger: console.log  // method to write log data
};

var demoStat = require('esay-stat')('demo', opt);
demoStat.launch();

// some where need to record the count of calling an api
// here I want record api_called for 5 times
demoStat.touch('api_called', 5);

then the demoStat will sum and write the total api_called to the log file which would looks like:

// name.key         timestamp  value
demoStat.api_called 1463582916 136

Readme

Keywords

Package Sidebar

Install

npm i easy-stat

Weekly Downloads

1

Version

0.2.2

License

MIT

Last publish

Collaborators

  • mekalz