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

log4js

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log4js - npm Package Compare versions

Comparing version 6.2.1 to 6.3.0

12

CHANGELOG.md
# log4js-node changelog
## 6.3.0
- [Add option to file appender to remove ANSI colours](https://github.com/log4js-node/log4js-node/pull/1001) - thanks [@BlueCocoa](https://github.com/BlueCocoa)
- [Do not create appender if no categories use it](https://github.com/log4js-node/log4js-node/pull/1002) - thanks [@rnd-debug](https://github.com/rnd-debug)
- [Docs: better categories inheritance description](https://github.com/log4js-node/log4js-node/pull/1003) - thanks [@rnd-debug](https://github.com/rnd-debug)
- [Better jsdoc docs](https://github.com/log4js-node/log4js-node/pull/1004) - thanks [@wataash](https://github.com/wataash)
- [Typescript: access category field in Logger](https://github.com/log4js-node/log4js-node/pull/1006) - thanks [@rtvd](https://github.com/rtvd)
- [Docs: influxdb appender](https://github.com/log4js-node/log4js-node/pull/1014) - thanks [@rnd-debug](https://github.com/rnd-debug)
- [Support for fileSync appender in webpack](https://github.com/log4js-node/log4js-node/pull/1015) - thanks [@lauren-li](https://github.com/lauren-li)
- [Docs: UDP appender](https://github.com/log4js-node/log4js-node/pull/1018) - thanks [@iassasin](https://github.com/iassasin)
- [Style: spaces and tabs](https://github.com/log4js-node/log4js-node/pull/1016) - thanks [@abetomo](https://github.com/abetomo)
## 6.2.1

@@ -4,0 +16,0 @@

@@ -56,2 +56,10 @@ const debug = require('debug')('log4js:file');

const app = function (loggingEvent) {
if (options.removeColor === true) {
// eslint-disable-next-line no-control-regex
const regex = /\x1b[[0-9;]*m/g;
loggingEvent.data = loggingEvent.data.map(d => {
if (typeof d === 'string') return d.replace(regex, '')
return d
})
}
if (!writer.write(layout(loggingEvent, timezoneOffset) + eol, "utf8")) {

@@ -58,0 +66,0 @@ process.emit('log4js:pause', true);

15

lib/appenders/index.js

@@ -19,2 +19,3 @@ const path = require('path');

coreAppenders.set('dateFile', require('./dateFile'));
coreAppenders.set('fileSync', require('./fileSync'));

@@ -86,3 +87,3 @@ const appenders = new Map();

);
}, () => {});
}, () => { });
};

@@ -93,8 +94,16 @@

appendersLoading.clear();
const usedAppenders = [];
Object.values(config.categories).forEach(category => {
usedAppenders.push(...category.appenders)
});
Object.keys(config.appenders).forEach((name) => {
getAppender(name, config);
// dodgy hard-coding of special case for tcp-server which may not have
// any categories associated with it, but needs to be started up anyway
if (usedAppenders.includes(name) || config.appenders[name].type === 'tcp-server') {
getAppender(name, config);
}
});
};
setup({ appenders: { out: { type: 'stdout' } } });
setup({ appenders: { out: { type: 'stdout' } }, categories: { default: { appenders: ['out'], level: 'trace' } } });

@@ -101,0 +110,0 @@ configuration.addListener((config) => {

6

lib/appenders/noLogFilter.js

@@ -7,4 +7,4 @@

* The function removes empty or null regexp from the array
* @param {Array<string>} regexp
* @returns {Array<string>} a filtered string array with not empty or null regexp
* @param {string[]} regexp
* @returns {string[]} a filtered string array with not empty or null regexp
*/

@@ -19,3 +19,3 @@ function removeNullOrEmptyRegexp(regexp) {

* with the regular expressions provided
* @param {string | Array<string>} filters contains the regexp that will be used for the evaluation
* @param {(string|string[])} filters contains the regexp that will be used for the evaluation
* @param {*} appender

@@ -22,0 +22,0 @@ * @returns {function}

@@ -13,4 +13,4 @@ const debug = require('debug')('log4js:categories');

* Inheritance is blocked if a category has inherit=false
* @param {any} config
* @param {any} category the child category
* @param {*} config
* @param {*} category the child category
* @param {string} categoryName dotted path to category

@@ -61,3 +61,3 @@ * @return {void}

* Inheritance is skipped where a category has inherit=false.
* @param {any} config
* @param {*} config
*/

@@ -64,0 +64,0 @@ function addCategoryInheritance(config) {

@@ -17,3 +17,3 @@ /* eslint-disable no-plusplus */

* @param {IncomingMessage} req
* @return {String}
* @return {string}
* @api private

@@ -115,5 +115,5 @@ */

*
* @param {String} str
* @param {string} str
* @param {Array} tokens
* @return {String}
* @return {string}
* @api private

@@ -131,3 +131,3 @@ */

*
* @param {String|Array} nolog
* @param {(string|Array)} nolog
* @return {RegExp}

@@ -134,0 +134,0 @@ * @api private

@@ -24,3 +24,3 @@

* converts given String to corresponding Level
* @param {Level|String} sArg -- String value of Level OR Log4js.Level
* @param {(Level|string)} sArg -- String value of Level OR Log4js.Level
* @param {Level} [defaultLevel] -- default Level, if no String representation

@@ -27,0 +27,0 @@ * @return {Level}

@@ -12,3 +12,3 @@ const flatted = require('flatted');

* @constructor
* @param {String} categoryName name of category
* @param {string} categoryName name of category
* @param {Log4js.Level} level level of message

@@ -15,0 +15,0 @@ * @param {Array} data objects to log

{
"name": "log4js",
"version": "6.2.1",
"version": "6.3.0",
"description": "Port of Log4js to work with node.",

@@ -5,0 +5,0 @@ "homepage": "https://log4js-node.github.io/log4js-node/",

# log4js-node [![Build Status](https://secure.travis-ci.org/log4js-node/log4js-node.png?branch=master)](http://travis-ci.org/log4js-node/log4js-node) [![codecov](https://codecov.io/gh/log4js-node/log4js-node/branch/master/graph/badge.svg)](https://codecov.io/gh/log4js-node/log4js-node)
[![NPM](https://nodei.co/npm/log4js.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/log4js/)

@@ -17,22 +16,24 @@

* coloured console logging to stdout or stderr
* file appender, with configurable log rolling based on file size or date
* a logger for connect/express servers
* configurable log message layout/patterns
* different log levels for different log categories (make some parts of your app log as DEBUG, others only ERRORS, etc.)
- coloured console logging to stdout or stderr
- file appender, with configurable log rolling based on file size or date
- a logger for connect/express servers
- configurable log message layout/patterns
- different log levels for different log categories (make some parts of your app log as DEBUG, others only ERRORS, etc.)
Optional appenders are available:
* [SMTP](https://github.com/log4js-node/smtp)
* [GELF](https://github.com/log4js-node/gelf)
* [Loggly](https://github.com/log4js-node/loggly)
* Logstash ([UDP](https://github.com/log4js-node/logstashUDP) and [HTTP](https://github.com/log4js-node/logstashHTTP))
* logFaces ([UDP](https://github.com/log4js-node/logFaces-UDP) and [HTTP](https://github.com/log4js-node/logFaces-HTTP))
* [RabbitMQ](https://github.com/log4js-node/rabbitmq)
* [Redis](https://github.com/log4js-node/redis)
* [Hipchat](https://github.com/log4js-node/hipchat)
* [Slack](https://github.com/log4js-node/slack)
* [mailgun](https://github.com/log4js-node/mailgun)
- [SMTP](https://github.com/log4js-node/smtp)
- [GELF](https://github.com/log4js-node/gelf)
- [Loggly](https://github.com/log4js-node/loggly)
- Logstash ([UDP](https://github.com/log4js-node/logstashUDP) and [HTTP](https://github.com/log4js-node/logstashHTTP))
- logFaces ([UDP](https://github.com/log4js-node/logFaces-UDP) and [HTTP](https://github.com/log4js-node/logFaces-HTTP))
- [RabbitMQ](https://github.com/log4js-node/rabbitmq)
- [Redis](https://github.com/log4js-node/redis)
- [Hipchat](https://github.com/log4js-node/hipchat)
- [Slack](https://github.com/log4js-node/slack)
- [mailgun](https://github.com/log4js-node/mailgun)
- [InfluxDB](https://github.com/rnd-debug/log4js-influxdb-appender)
## Getting help
Having problems? Jump on the [slack](https://join.slack.com/t/log4js-node/shared_invite/enQtODkzMDQ3MzExMDczLWUzZmY0MmI0YWI1ZjFhODY0YjI0YmU1N2U5ZTRkOTYyYzg3MjY5NWI4M2FjZThjYjdiOGM0NjU2NzBmYTJjOGI) channel, or create an issue. If you want to help out with the development, the slack channel is a good place to go as well.

@@ -49,29 +50,36 @@

Minimalist version:
```javascript
var log4js = require('log4js');
var log4js = require("log4js");
var logger = log4js.getLogger();
logger.level = 'debug';
logger.level = "debug";
logger.debug("Some debug messages");
```
By default, log4js will not output any logs (so that it can safely be used in libraries). The `level` for the `default` category is set to `OFF`. To enable logs, set the level (as in the example). This will then output to stdout with the coloured layout (thanks to [masylum](http://github.com/masylum)), so for the above you would see:
```bash
[2010-01-17 11:43:37.987] [DEBUG] [default] - Some debug messages
```
See example.js for a full example, but here's a snippet (also in `examples/fromreadme.js`):
```javascript
const log4js = require('log4js');
const log4js = require("log4js");
log4js.configure({
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
appenders: { cheese: { type: "file", filename: "cheese.log" } },
categories: { default: { appenders: ["cheese"], level: "error" } }
});
const logger = log4js.getLogger('cheese');
logger.trace('Entering cheese testing');
logger.debug('Got cheese.');
logger.info('Cheese is Comté.');
logger.warn('Cheese is quite smelly.');
logger.error('Cheese is too ripe!');
logger.fatal('Cheese was breeding ground for listeria.');
const logger = log4js.getLogger("cheese");
logger.trace("Entering cheese testing");
logger.debug("Got cheese.");
logger.info("Cheese is Comté.");
logger.warn("Cheese is quite smelly.");
logger.error("Cheese is too ripe!");
logger.fatal("Cheese was breeding ground for listeria.");
```
Output (in `cheese.log`):
```bash

@@ -87,2 +95,3 @@ [2010-01-17 11:43:37.987] [ERROR] cheese - Cheese is too ripe!

## Documentation
Available [here](https://log4js-node.github.io/log4js-node/).

@@ -93,12 +102,13 @@

## TypeScript
```ts
import { configure, getLogger } from 'log4js';
configure('./filename');
import { configure, getLogger } from "log4js";
configure("./filename");
const logger = getLogger();
logger.level = 'debug';
logger.level = "debug";
logger.debug("Some debug messages");
configure({
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
appenders: { cheese: { type: "file", filename: "cheese.log" } },
categories: { default: { appenders: ["cheese"], level: "error" } }
});

@@ -105,0 +115,0 @@ ```

@@ -6,9 +6,9 @@ // Type definitions for log4js

export interface Log4js {
getLogger(category?: string): Logger;
configure(filename: string): Log4js;
configure(config: Configuration): Log4js;
addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void;
connectLogger(logger: Logger, options: { format?: Format; level?: string; nolog?: any; }): any; // express.Handler;
levels: Levels;
shutdown(cb: (error: Error) => void): void | null;
getLogger(category?: string): Logger;
configure(filename: string): Log4js;
configure(config: Configuration): Log4js;
addLayout(name: string, config: (a: any) => (logEvent: LoggingEvent) => string): void;
connectLogger(logger: Logger, options: { format?: Format; level?: string; nolog?: any; }): any; // express.Handler;
levels: Levels;
shutdown(cb: (error: Error) => void): void | null;
}

@@ -30,23 +30,23 @@

export interface BaseLayout {
type: 'basic';
type: 'basic';
}
export interface ColoredLayout {
type: 'colored' | 'coloured';
type: 'colored' | 'coloured';
}
export interface MessagePassThroughLayout {
type: 'messagePassThrough';
type: 'messagePassThrough';
}
export interface DummyLayout {
type: 'dummy';
type: 'dummy';
}
export interface Level {
isEqualTo(other: string): boolean;
isEqualTo(otherLevel: Level): boolean;
isLessThanOrEqualTo(other: string): boolean;
isLessThanOrEqualTo(otherLevel: Level): boolean;
isGreaterThanOrEqualTo(other: string): boolean;
isEqualTo(other: string): boolean;
isEqualTo(otherLevel: Level): boolean;
isLessThanOrEqualTo(other: string): boolean;
isLessThanOrEqualTo(otherLevel: Level): boolean;
isGreaterThanOrEqualTo(other: string): boolean;
isGreaterThanOrEqualTo(otherLevel: Level): boolean;

@@ -59,12 +59,12 @@ colour: string;

export interface LoggingEvent {
categoryName: string; // name of category
level: Level; // level of message
data: any[]; // objects to log
startTime: Date;
pid: number;
context: any;
cluster?: {
workerId: number;
worker: number;
};
categoryName: string; // name of category
level: Level; // level of message
data: any[]; // objects to log
startTime: Date;
pid: number;
context: any;
cluster?: {
workerId: number;
worker: number;
};
}

@@ -75,12 +75,12 @@

export interface PatternLayout {
type: 'pattern';
// specifier for the output format, using placeholders as described below
pattern: string;
// user-defined tokens to be used in the pattern
tokens?: { [name: string]: Token };
type: 'pattern';
// specifier for the output format, using placeholders as described below
pattern: string;
// user-defined tokens to be used in the pattern
tokens?: { [name: string]: Token };
}
export interface CustomLayout {
[key: string]: any;
type: string;
[key: string]: any;
type: string;
}

@@ -96,7 +96,7 @@

export interface CategoryFilterAppender {
type: "categoryFilter";
// the category (or categories if you provide an array of values) that will be excluded from the appender.
exclude?: string | string[];
// the name of the appender to filter. see https://log4js-node.github.io/log4js-node/layouts.html
appender?: string;
type: "categoryFilter";
// the category (or categories if you provide an array of values) that will be excluded from the appender.
exclude?: string | string[];
// the name of the appender to filter. see https://log4js-node.github.io/log4js-node/layouts.html
appender?: string;
}

@@ -116,3 +116,3 @@

// the name of an appender, defined in the same configuration, that you want to filter.
appender: string;
appender: string;
}

@@ -126,143 +126,143 @@

export interface ConsoleAppender {
type: 'console';
// defaults to colouredLayout
layout?: Layout;
type: 'console';
// defaults to colouredLayout
layout?: Layout;
}
export interface FileAppender {
type: 'file';
// the path of the file where you want your logs written.
filename: string;
// the maximum size (in bytes) for the log file. If not specified, then no log rolling will happen.
maxLogSize?: number | string;
// (default value = 5) - the number of old log files to keep during log rolling.
backups?: number;
// defaults to basic layout
layout?: Layout;
numBackups?: number;
compress?: boolean; // compress the backups
// keep the file extension when rotating logs
keepFileExt?: boolean;
encoding?: string;
mode?: number;
flags?: string;
type: 'file';
// the path of the file where you want your logs written.
filename: string;
// the maximum size (in bytes) for the log file. If not specified, then no log rolling will happen.
maxLogSize?: number | string;
// (default value = 5) - the number of old log files to keep during log rolling.
backups?: number;
// defaults to basic layout
layout?: Layout;
numBackups?: number;
compress?: boolean; // compress the backups
// keep the file extension when rotating logs
keepFileExt?: boolean;
encoding?: string;
mode?: number;
flags?: string;
}
export interface SyncfileAppender {
type: 'fileSync';
// the path of the file where you want your logs written.
filename: string;
// the maximum size (in bytes) for the log file. If not specified, then no log rolling will happen.
maxLogSize?: number | string;
// (default value = 5) - the number of old log files to keep during log rolling.
backups?: number;
// defaults to basic layout
layout?: Layout;
type: 'fileSync';
// the path of the file where you want your logs written.
filename: string;
// the maximum size (in bytes) for the log file. If not specified, then no log rolling will happen.
maxLogSize?: number | string;
// (default value = 5) - the number of old log files to keep during log rolling.
backups?: number;
// defaults to basic layout
layout?: Layout;
}
export interface DateFileAppender {
type: 'dateFile';
// the path of the file where you want your logs written.
filename: string;
// defaults to basic layout
layout?: Layout;
// defaults to .yyyy-MM-dd - the pattern to use to determine when to roll the logs.
/**
* The following strings are recognised in the pattern:
* - yyyy : the full year, use yy for just the last two digits
* - MM : the month
* - dd : the day of the month
* - hh : the hour of the day (24-hour clock)
* - mm : the minute of the hour
* - ss : seconds
* - SSS : milliseconds (although I'm not sure you'd want to roll your logs every millisecond)
* - O : timezone (capital letter o)
*/
pattern?: string;
// default “utf-8”
encoding?: string;
// default 0644
mode?: number;
// default ‘a’
flags?: string;
// compress the backup files during rolling (backup files will have .gz extension)(default false)
compress?: boolean;
// include the pattern in the name of the current log file as well as the backups.(default false)
alwaysIncludePattern?: boolean;
// keep the file extension when rotating logs
keepFileExt?: boolean;
// if this value is greater than zero, then files older than that many days will be deleted during log rolling.(default 0)
daysToKeep?: number;
type: 'dateFile';
// the path of the file where you want your logs written.
filename: string;
// defaults to basic layout
layout?: Layout;
// defaults to .yyyy-MM-dd - the pattern to use to determine when to roll the logs.
/**
* The following strings are recognised in the pattern:
* - yyyy : the full year, use yy for just the last two digits
* - MM : the month
* - dd : the day of the month
* - hh : the hour of the day (24-hour clock)
* - mm : the minute of the hour
* - ss : seconds
* - SSS : milliseconds (although I'm not sure you'd want to roll your logs every millisecond)
* - O : timezone (capital letter o)
*/
pattern?: string;
// default “utf-8”
encoding?: string;
// default 0644
mode?: number;
// default ‘a’
flags?: string;
// compress the backup files during rolling (backup files will have .gz extension)(default false)
compress?: boolean;
// include the pattern in the name of the current log file as well as the backups.(default false)
alwaysIncludePattern?: boolean;
// keep the file extension when rotating logs
keepFileExt?: boolean;
// if this value is greater than zero, then files older than that many days will be deleted during log rolling.(default 0)
daysToKeep?: number;
}
export interface LogLevelFilterAppender {
type: 'logLevelFilter';
// the name of an appender, defined in the same configuration, that you want to filter
appender: string;
// the minimum level of event to allow through the filter
level: string;
// (defaults to FATAL) - the maximum level of event to allow through the filter
maxLevel?: string;
type: 'logLevelFilter';
// the name of an appender, defined in the same configuration, that you want to filter
appender: string;
// the minimum level of event to allow through the filter
level: string;
// (defaults to FATAL) - the maximum level of event to allow through the filter
maxLevel?: string;
}
export interface MultiFileAppender {
type: 'multiFile';
// the base part of the generated log filename
base: string;
// the value to use to split files (see below).
property: string;
// the suffix for the generated log filename.
extension: string;
type: 'multiFile';
// the base part of the generated log filename
base: string;
// the value to use to split files (see below).
property: string;
// the suffix for the generated log filename.
extension: string;
}
export interface MultiprocessAppender {
type: 'multiprocess';
// controls whether the appender listens for log events sent over the network, or is responsible for serialising events and sending them to a server.
mode: 'master' | 'worker';
// (only needed if mode == master)- the name of the appender to send the log events to
appender?: string;
// (defaults to 5000) - the port to listen on, or send to
loggerPort?: number;
// (defaults to localhost) - the host/IP address to listen on, or send to
loggerHost?: string;
type: 'multiprocess';
// controls whether the appender listens for log events sent over the network, or is responsible for serialising events and sending them to a server.
mode: 'master' | 'worker';
// (only needed if mode == master)- the name of the appender to send the log events to
appender?: string;
// (defaults to 5000) - the port to listen on, or send to
loggerPort?: number;
// (defaults to localhost) - the host/IP address to listen on, or send to
loggerHost?: string;
}
export interface RecordingAppender {
type: 'recording';
type: 'recording';
}
export interface StandardErrorAppender {
type: 'stderr';
// (defaults to colouredLayout)
layout?: Layout;
type: 'stderr';
// (defaults to colouredLayout)
layout?: Layout;
}
export interface StandardOutputAppender {
type: 'stdout';
// (defaults to colouredLayout)
layout?: Layout;
type: 'stdout';
// (defaults to colouredLayout)
layout?: Layout;
}
export interface CustomAppender {
type: string | AppenderModule;
[key: string]: any;
type: string | AppenderModule;
[key: string]: any;
}
export interface AppenderModule {
configure: Function
configure: Function
}
export type Appender = CategoryFilterAppender
| ConsoleAppender
| FileAppender
| SyncfileAppender
| DateFileAppender
| ConsoleAppender
| FileAppender
| SyncfileAppender
| DateFileAppender
| LogLevelFilterAppender
| NoLogFilterAppender
| MultiFileAppender
| MultiprocessAppender
| RecordingAppender
| StandardErrorAppender
| StandardOutputAppender
| CustomAppender;
| MultiFileAppender
| MultiprocessAppender
| RecordingAppender
| StandardErrorAppender
| StandardOutputAppender
| CustomAppender;

@@ -285,49 +285,50 @@ export interface Levels {

export interface Configuration {
appenders: { [name: string]: Appender; };
categories: { [name: string]: { appenders: string[]; level: string; enableCallStack?: boolean; } };
pm2?: boolean;
pm2InstanceVar?: string;
levels?: Levels;
disableClustering?: boolean;
appenders: { [name: string]: Appender; };
categories: { [name: string]: { appenders: string[]; level: string; enableCallStack?: boolean; } };
pm2?: boolean;
pm2InstanceVar?: string;
levels?: Levels;
disableClustering?: boolean;
}
export class Logger {
new(dispatch: Function, name: string): Logger;
new(dispatch: Function, name: string): Logger;
readonly category: string;
level: string;
log(...args: any[]): void;
log(...args: any[]): void;
isLevelEnabled(level?: string): boolean;
isLevelEnabled(level?: string): boolean;
isTraceEnabled(): boolean;
isDebugEnabled(): boolean;
isInfoEnabled(): boolean;
isWarnEnabled(): boolean;
isErrorEnabled(): boolean;
isFatalEnabled(): boolean;
isTraceEnabled(): boolean;
isDebugEnabled(): boolean;
isInfoEnabled(): boolean;
isWarnEnabled(): boolean;
isErrorEnabled(): boolean;
isFatalEnabled(): boolean;
_log(level: string, data: any): void;
_log(level: string, data: any): void;
addContext(key: string, value: any): void;
addContext(key: string, value: any): void;
removeContext(key: string): void;
removeContext(key: string): void;
clearContext(): void;
clearContext(): void;
setParseCallStackFunction(parseFunction: Function): void;
setParseCallStackFunction(parseFunction: Function): void;
trace(message: any, ...args: any[]): void;
trace(message: any, ...args: any[]): void;
debug(message: any, ...args: any[]): void;
debug(message: any, ...args: any[]): void;
info(message: any, ...args: any[]): void;
info(message: any, ...args: any[]): void;
warn(message: any, ...args: any[]): void;
warn(message: any, ...args: any[]): void;
error(message: any, ...args: any[]): void;
error(message: any, ...args: any[]): void;
fatal(message: any, ...args: any[]): void;
fatal(message: any, ...args: any[]): void;
mark(message: any, ...args: any[]): void;
mark(message: any, ...args: any[]): void;
}

@@ -20,37 +20,37 @@ import * as log4js from './log4js';

log4js.configure({
appenders: { cheese: { type: 'console', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
appenders: { cheese: { type: 'console', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
});
log4js.configure({
appenders: {
out: { type: 'file', filename: 'pm2logs.log' }
},
categories: {
default: { appenders: ['out'], level: 'info' }
},
pm2: true,
pm2InstanceVar: 'INSTANCE_ID'
appenders: {
out: { type: 'file', filename: 'pm2logs.log' }
},
categories: {
default: { appenders: ['out'], level: 'info' }
},
pm2: true,
pm2InstanceVar: 'INSTANCE_ID'
});
log4js.addLayout('json', config => function (logEvent) {
return JSON.stringify(logEvent) + config.separator;
return JSON.stringify(logEvent) + config.separator;
});
log4js.configure({
appenders: {
out: { type: 'stdout', layout: { type: 'json', separator: ',' } }
},
categories: {
default: { appenders: ['out'], level: 'info' }
}
appenders: {
out: { type: 'stdout', layout: { type: 'json', separator: ',' } }
},
categories: {
default: { appenders: ['out'], level: 'info' }
}
});
log4js.configure({
appenders: {
file: { type: 'dateFile', filename: 'thing.log', pattern: '.mm' }
},
categories: {
default: { appenders: ['file'], level: 'debug' }
}
appenders: {
file: { type: 'dateFile', filename: 'thing.log', pattern: '.mm' }
},
categories: {
default: { appenders: ['file'], level: 'debug' }
}
});

@@ -68,11 +68,11 @@

log4js.configure({
appenders: {
cheeseLogs: { type: 'file', filename: 'cheese.log' },
console: { type: 'console' }
},
categories: {
cheese: { appenders: ['cheeseLogs'], level: 'error' },
another: { appenders: ['console'], level: 'trace' },
default: { appenders: ['console', 'cheeseLogs'], level: 'trace' }
}
appenders: {
cheeseLogs: { type: 'file', filename: 'cheese.log' },
console: { type: 'console' }
},
categories: {
cheese: { appenders: ['cheeseLogs'], level: 'error' },
another: { appenders: ['console'], level: 'trace' },
default: { appenders: ['console', 'cheeseLogs'], level: 'trace' }
}
});

@@ -114,4 +114,4 @@

configure({
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
categories: { default: { appenders: ['cheese'], level: 'error' } }
});

@@ -118,0 +118,0 @@

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