Skip to content

Instantly share code, notes, and snippets.

@framlin
Created May 3, 2012 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save framlin/2585378 to your computer and use it in GitHub Desktop.
Save framlin/2585378 to your computer and use it in GitHub Desktop.
var frinerva = require('./frinerva');
// .....
} else if (nconf.get('i')) {
frinerva.inform(nconf.get('i'));
}
///.....
function display() {
console.log.apply(this, arguments);
}
function inform(id) {
load(function (err, data) {
var log = JSON.parse(data.toString()),
size = log.length,
i = 0,
entry = null;
for (i = 0; i < size; i += 1) {
entry = log[i];
if ((entry.cmd === 'info') && entry.id && (entry.id == id.toLowerCase())) {
display('[%s][%s]: %s',
entry.id,
entry.cmd,
entry.msg ? entry.msg : '');
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment