Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
208 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
|
||
require('colors'); | ||
var _ = require('lodash'); | ||
// load configuration | ||
var app = {}; | ||
var config = require("./config"); | ||
|
||
var Log = config.logger.getLogger("TEST"); | ||
|
||
Log.info("INFO"); | ||
|
||
console.log(config.memLogger.getBuffer()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,8 @@ var Auth = function(app) { | |
}; | ||
|
||
return this; | ||
} | ||
}; | ||
|
||
module.exports = function(app) { | ||
return new Auth(app); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"use strict"; | ||
|
||
module.exports = function(options){ | ||
var layouts = require('log4js').layouts; | ||
var buffer = null; | ||
var maxBufferSize = null; | ||
|
||
options = options || {}; | ||
buffer = options.buffer || []; | ||
maxBufferSize = options.maxBufferSize || 100; | ||
|
||
var memoryAppender = function(layout, timezoneOffset) { | ||
layout = layout || layouts.basicLayout; | ||
return function(loggingEvent) { | ||
if((buffer.length + 1) > maxBufferSize) | ||
{ | ||
var numtoRemove = (buffer.length - maxBufferSize) + 1; | ||
if(numtoRemove > 0){ buffer.splice(0, numtoRemove); } | ||
} | ||
buffer.push(layout(loggingEvent, timezoneOffset)); | ||
}; | ||
}; | ||
|
||
var configure = function(config) { | ||
var layout = null; | ||
if (config.layout) { | ||
layout = layouts.layout(config.layout.type, config.layout); | ||
} | ||
if(config.maxBufferSize){ | ||
maxBufferSize = config.maxBufferSize; | ||
} | ||
return memoryAppender(layout, config.timezoneOffset); | ||
}; | ||
|
||
var getBuffer = function(){ | ||
return(buffer.slice()); | ||
}; | ||
|
||
var flushBuffer = function(){ | ||
buffer = []; | ||
}; | ||
|
||
return({ | ||
appender: memoryAppender, | ||
configure: configure, | ||
getBuffer: getBuffer, | ||
flushBuffer: flushBuffer | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.