brickflow-logger
brickflow-logger
is a logger around winston
,
which aims to be a complete logging solution for node/express apps.
Usage
var metrics = logstash: host port ... amqp: connection: ; var logger = metrics; logger; // => info: eventName url=undefined, ip=null, eventType=loggerName, // affiliateID=undefined, distinct_id=undefined, some=options, // and.it.0=canBe, and.it.1=nested
Time measurement features
Create a time tracker and track some time:
var metrics = ...; var tracker = ; var measureDuration = tracker // Starts the timer var lapInfo = measureDuration; measureDuration; var durationLogger = measureDuration; // ends the timer var durationLogger = measureDuration // same
At this point, durationLogger
behaves as a logger (has info
,
error
, ...) except that it automatically logs the durations and dates
based on the names you give and also contains the measured information,
if you want to inspect what has happened.
durationLoggerkey === 'you-name-it' durationLogger;
Funnel
createFunnelTracker
is similar, automatically logs when you call lap
.
It can also be used with the more intutive start
-step
-end
aliases.
var metrics = ...; var tracker = metrics; var funnel = trackerstart'funnelName' distinctRandom: 4; funnel; // alias for ``lap()`` funnel; funnel // automatically logs a summary called 'funnelName' funnel // end silently