From a98fe3ef7c49b2b6cf28d3d0e47521062bf27a8b Mon Sep 17 00:00:00 2001 From: Mathew Kurian Date: Mon, 19 May 2014 11:01:50 -0500 Subject: [PATCH] Update index.js --- src/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 2d51f32..823ee2f 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ var util = require('util') , fs = require('fs'); var APP_NAME = "Mus.ec"; -var LOG_PATH = "./scribe"; +var LOG_PATH = "./.."; var MAIN_USER = "root"; // Logger information which will be read by the 'overload' function when @@ -230,11 +230,16 @@ var getlog = function(req, res) { } var type = req.param('type'); - type = type ? type : "log"; + var raw = req.param('raw'); var contents = "No log found"; + + raw = raw ? true : false; + type = type ? type : "log"; + fs.readFile(LOG_PATH + "/log/" + date + "/" + MAIN_USER + "/app." + type, 'utf8', function(err, data) { if (!err) contents = data; - // contents = contents.replace(/^(.*?)#\|#/mg, '$1#\|#') + if(raw) return res.send("
" + contents + "
"); + contents = contents.replace(/ /g, ' ') contents = contents.replace(regA, '$1$2'); contents = contents.replace(regB, '$1$2$3');