Permalink
Browse files

removed old file and fixed for cfdump logs

  • Loading branch information...
1 parent 92f6fde commit 441d0f0456359a08b6468896774e72643e02a67e @amaurer committed Dec 14, 2012
Showing with 7 additions and 28 deletions.
  1. +7 −2 log-massage.js
  2. +0 −26 main.js
View
@@ -28,18 +28,23 @@ function LogMassage(){
};
};
+LogMassage.prototype.fixFunkiness = function(stringData){
+ return stringData.replace(/\",,\"/g, "\",\"\",\"").replace(/\",,,\"/g, "\",\"\",\"\",\"");
+};
+
LogMassage.prototype.toArrays = function(stringData){
if(typeof stringData !== "string") return this;
var i, ii, len, lenn, x, tmp;
var logResults = [];
- var rows = stringData.toString().split(this.rowDelimiter);
+ var normalizedString = this.fixFunkiness(stringData.toString());
+ var rows = normalizedString.split(this.rowDelimiter);
var cells = [];
var replaceQuotes = /"/g;
var replaceCarriageReturns = /\r/g;
for (i = 1, len = rows.length; i<len; i++) {
x = rows[i];
- if(x === "" || x.length === 0) continue;
+ if(x === "" || x.length === 0 || x.substr(0,1) !== "\"") continue;
cells = x.split(this.cellDelimiter);
tmp = [];
for (ii = 0, lenn = cells.length; ii<lenn; ii++) {
View
@@ -1,26 +0,0 @@
-var fs = require("fs");
-var LogMassage = require("./log-massage.js");
-
-var logFilePath = "X:\\JRun4\\servers\\OEMLR_Sean\\cfusion.ear\\cfusion.war\\WEB-INF\\cfusion\\logs\\Dean.log";
-
-
-fs.readFile(logFilePath, function(e, data){
-
- var count = 0;
- var lm = new LogMassage(data)
- .toDate(2, 3)
- .removeRowCells(1, 4)
- .filterBetween(
- new Date("12/03/12"),
- new Date("12/04/12"),
- 2
- )
- .eachRow(function(rowIndex, row){
- count++;
- return true;
- });
-
- //console.log(lm);
- console.log(count);
-
-});

0 comments on commit 441d0f0

Please sign in to comment.