0.0.23 • Published 8 years ago

logger-tracker v0.0.23

Weekly downloads
79
License
-
Repository
-
Last release
8 years ago

Logger tracker

Event tracking and logging

Tracker

Exports a TRACKER variable

Usage

import { TRACKER } from 'request-tracker';

// initialize the tracker
TRACKER.init(options);

// call track wherever you want to track events
TRACKER.track(options);

Functions

####TRACKER.init(options) Initializes the TRACKER constant with supplied options Supports the following options:

version (string): version of the application you're tracking

url (string): The URL that the event logs will be posted to

context (string): a map of tracker-wide context values that will be added to each event

####TRACKER.track(options) Can be called inside routes or middleware functions with option values being functions of request objects (and additional middleware functions like morgan). These options will be added to the event entry. Supports the following options:

eventType (string): required type of event you're tracking for example 'login'

metric (string): required The name of the metric you're tracking

value (number): required The value of the metric you're tracking

user ({k: string: v: any}): JSON representation of a user on which you can specify attribute that will be written to the resulting event entry. Currently supported attribute are id and email

attr ({k: string: v: string}): Maps custom attribute names to string properties.

Logger

A small utility that ensures this is bound to the console object. Exports a LOGGER variable to interface with.

Usage

import { LOGGER } from 'request-tracker';

LOGGER.init();

LOGGER.log('hello');
LOGGER.warn('warning');
LOGGER.error('error');
0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago