This project is still in early stages of development.
var Logger = ; // May also use window.Logger// Create a logger for "Stats" componentvar stats = Logger;// Log levelsstats;stats;stats;stats;stats;// Getters / Settersstats // returns 'Stats'stats // You probably won't need to use this reallystats;stats; // Returns level as a Number
Logs can easily be uploaded to a server. When creating a logger pass a third parameter as true. You must also call setUploadFn on the Logger object and provide a function that accepts two parameters, a string and a callback function. The callback function is setup to follow the Node.js convention of taking two parameters; the first being an error if one occured, otherwise it's null, the second being a result. Currently Logger doesn't look at the result, but if an error occurs it will need to be notified via that first parameter otherwise your logs will be deleted without having reached your server!
Logger;// Logs is a JSON String containing an Array of ObjectsLogger;
This tells Logger to store and upload logs associated with this logger. Logs are stored in window.localStorage (DOM Storage). Once logs are uploaded they are deleted from localStorage. Indexing is used to ensure parsing logs for upload is as performant as possible as localStorage is blocking for I/O.