Skip to content

Instantly share code, notes, and snippets.

@suisho
Last active August 29, 2015 13:58
Show Gist options
  • Save suisho/10023591 to your computer and use it in GitHub Desktop.
Save suisho/10023591 to your computer and use it in GitHub Desktop.
Tail = require('tail').Tail;
var path = require("path")
var filename = path.resolve(process.argv[2]);
tail = new Tail(filename);
tail.on("line", function(data) {
try{
var parsed = JSON.parse(data)
console.log(JSON.stringify(parsed, null, " "))
}catch(e){
console.log(data);
}
});
{
"name": "hotail",
"version": "0.0.0",
"main": "index.js",
"dependencies": {
"tail": "^0.3.5"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment