Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

log4js-memory-appender

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log4js-memory-appender - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

23

log4js-memory-appender.js
"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 @@ };

2

package.json
{
"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());
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc