Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@log4js2/core
Advanced tools
log4js2 is a fast and lightweight logging library that enables logging flexibility within JavaScript/TypeScript applications, similar to Apache's [Log4j2 library](https://logging.apache.org/log4j/2.x/). It can also serve as a drop-in replacement for log4
log4js2 is a fast and lightweight logging library that enables logging flexibility within JavaScript/TypeScript applications, similar to Apache's Log4j2 library. It can also serve as a drop-in replacement for log4js, since the namespace and functions are mostly similar.
If you're building from source, simply run
> npm install
> npm run build
Or, you can install log4js2 from npm.
> npm install --save @log4js2/core
Logging works out-of-the-box, with no configuration. However, note that only error messages will display without specific configuration.
import {getLogger} from '@log4js2/core';
const logger = getLogger('myLogger');
console.error('Console error'); // this will show
logger.error('This is an error log'); // this will show
logger.debug('This is a debug log'); // this will not show
Configure log4js using the configure()
method. This must be the first thing you do. Otherwise,
the first log you commit will not allow updates from this function
import {configure, LogLevel} from '@log4js2/core';
configure({
layout : '%d [%p] %c %M:%line:%column - %m %ex',
appenders : ['Console'],
loggers : [{
tag: 'App',
logLevel : LogLevel.INFO
}]
});
This library utilizes a virtual console to intercept console
logs from other libraries/scripts. This is intended to
allow usage of this library without having to replace all console.log commands within your code - or to intercept logs
from third-party libraries to input into your own logs bucket. Make sure log4js2
is loaded at the top of the page to
ensure that all logs are caught.
import * from '@log4js2/core';
console.log('console log');
// outputs: 08-30-2018 12:38:00 [INFO] main - console log
To disable this feature, set the virtualConsole
property to false when configuring log4js2.
configure({
// ...
virtualConsole: false
});
Library built and maintained by Robin Schultz
If you would like to contribute (aka buy me a beer), you can send funds via PayPal at the link below.
FAQs
log4js2 is a fast and lightweight logging library that enables logging flexibility within JavaScript/TypeScript applications, similar to Apache's [Log4j2 library](https://logging.apache.org/log4j/2.x/). It can also serve as a drop-in replacement for log4
We found that @log4js2/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.