grantcarthew/node-perj

Add statistics for status reporting

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

Status reporting on a Web API.

Describe the solution you'd like

An internal register of the types of logs and the number of times they have been called.

Describe alternatives you've considered

This could be added by extending the perj object however I would like this internal to perj.

Additional context

A possible API could be a status property that returns an object.

perj.status

// Returns something like this:
{
  uptime: 1234565,
  info: 3987938743,
  warn: 84
  error: 1
}

Possible values to return:

  • upTime
  • count of each log level call

Implementation could be through an internal event system or using the log.parent to an object directly on the top parent object.

Considerations:

  • Performance.
  • Storage of statistics.
  • Sync vs Async and the overhead of using setImmediate.
  • Browser support (for async setImmediate vs setTimeout vs ??).