timeline-logger

A NodeJs timeline logger tool for generating timeline json files for viewing in the chrome browser

npm install timeline-logger
4 downloads in the last month

Timeline Logger

Build Status NPM version Dependency Status Gittip donate button Bitdeli Badge

This logger helps generates a timeline JSON file that's compatible with the Chrome Dev Tools timeline viewer

Installation

npm install timeline-logger

Usage

var timeline = require('timeline-logger');
var builder = new timeline.TimelineBuilder();

// create a Program record
programEvent = builder.createEvent("Program");

// create a TimeStamp record
builder.createEvent("TimeStamp", {message: "hi mum!"});

//    do some stuff
for(var index; index<100; index++)
    console.log("Some output");

// end the TimeStamp record
builder.end();

// end the Program record
builder.end();

var logger = new timeline.TimelineLogger();
logger.save "some-file-path", programEvent

API

TimelineLogger
name type args description
save method string filepath, timelineRecordList[] saves an array of timeline records to a file specified by the filepath
TimelineBuilder
name type args description
startEvent method string type, [object data] starts a timeline event. Types are defined in TimelineRecordTypes
endEvent method none ends the currently started timeline event.

<--|reset |method|none|resets all events back to no events -->

TimelineRecord
name type args description
start method none sets startTime to Date.now()
end method none sets endTime to Date.now()
startTime number
endTime number
children TimelineRecord[]
data object
frameId number
usedHeapSize number
usedHeapSizeDelta number
counters object
stackTrace object

History

You can discover the history inside the History.md file

Contributing

You can discover the contributing instructions inside the Contributing.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2013+ Stringz Solutions Ltd
Copyright © 2013+ Peter Flannery

npm loves you