log4js-memory-appender
Advanced tools
Comparing version 1.0.3 to 1.0.4
"use strict"; | ||
/******************************************************** | ||
* Memory appender module for log4js. | ||
********************************************************/ | ||
module.exports = function(options){ | ||
@@ -12,3 +15,6 @@ var layouts = require('log4js').layouts; | ||
var memoryAppender = function(layout, timezoneOffset) { | ||
/******************************************************** | ||
* Constructs a new memory appender. | ||
********************************************************/ | ||
var memoryAppender = function memoryAppender(layout, timezoneOffset) { | ||
layout = layout || layouts.basicLayout; | ||
@@ -25,3 +31,6 @@ return function(loggingEvent) { | ||
var configure = function(config) { | ||
/******************************************************** | ||
* Configures and returns a new memory appender. | ||
********************************************************/ | ||
var configure = function configure(config) { | ||
var layout = null; | ||
@@ -37,7 +46,13 @@ if (config.layout) { | ||
var getBuffer = function(){ | ||
/******************************************************** | ||
* Returns a copy of the log buffer. | ||
********************************************************/ | ||
var getBuffer = function getBuffer(){ | ||
return(buffer.slice()); | ||
}; | ||
var flushBuffer = function(){ | ||
/******************************************************** | ||
* Flushes (empties the log buffer). | ||
********************************************************/ | ||
var flushBuffer = function flushBuffer(){ | ||
buffer = []; | ||
@@ -44,0 +59,0 @@ }; |
{ | ||
"name": "log4js-memory-appender", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A simple memory appender for log4js. It stores log events in an array - good for keeping a buffer of tail logs to output on a diagnostics page.", | ||
@@ -5,0 +5,0 @@ "main": "log4js-memory-appender.js", |
@@ -62,5 +62,10 @@ # log4js-memory-appender | ||
console.log("Flushing the buffer."); | ||
memAppender.flushBuffer(); | ||
console.log(memAppender.getBuffer()); | ||
``` | ||
## output | ||
## Example Output | ||
@@ -67,0 +72,0 @@ ``` |
@@ -21,2 +21,6 @@ var log4js = require('log4js'); | ||
console.log(memAppender.getBuffer()); | ||
console.log("Flushing the buffer."); | ||
memAppender.flushBuffer(); | ||
console.log(memAppender.getBuffer()); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8083
91
84