Extendable logging module, with support for logging to remote servers, disk, and GCM!
A simple logging module for NodeJS. I had to create my own logging plugin for all of my node projects, and ended up adding so many features that it now consists of enough functionality to move into a seperate, official module.
I'll continue to add more handlers to it over time, but for now this should suffice. If you find any bugs, or wish to contribute, feel free to send a pull request or create a new issue :)
I've created a basic example, and will add more as I migrate more functionality from my various projects
var spew = require"../spew.js";var fs = require"fs";spewsetLogLevel10;spewinit"Example starting up...";spew.info"Looking for README.md...";tryfsstat"../README.md"iferrspew.error"Encountered an error: " + err;elseifstatsisFilespew.info"Found README.md, printing to console...";fsreadFile"../README.md" encoding: "UTF-8"iferrspew.error"Encountered an error: " + err;elseconsole.logdata;spew.info"Done!";;elsespewwarning"README.md is a directory, can't proceed!";;catchespew.error"README.md not found!";
var spew = require"../spew.js";spewsetLogLevel10;spewinit"Example starting up...";// This is a FAKE API key! Generate a proper one atspewgetChannel"gcm"setup"AIzaSyDcSyCv5DGy8-Rn2RUuURv2n6l-i3yZn6o";spewenableChannel"gcm";// This is a FAKE registration id! You must receive and store these yourselfspewregIdspush"MAMSD1bEM3dd4gy_MroibDuf7PWePtXRXVxM1Oq_bJHbpvT6xLTQE8ifycmOlkssdfnJlv2TyBnI_sqOmeHHDsksmasndnfDHxp8rqba0u2P9vSTAXw_lZkg3L5buobgExpryg5abADGqsnkyYMgfakskdz06l_VdhA";spew.info"You should get this on your phone!"; // Also on the console :)