Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
anylogger-log4js
Advanced tools
.
This is an anylogger adapter for log4js.
This package is meant for application projects that are using libraries using anylogger
. By including this adapter in your project, all libraries using anylogger
will automatically start to use log4js
as their logging framework.
Install this adapter, as well as both anylogger
and log4js
:
npm install --save anylogger-log4js anylogger log4js
This package is meant for application projects. If you are writing a library to be NPM installed into some other project, most likely you should not include any adapter, but instead just use anylogger
directly.
The anylogger-log4js
adapter will modify the anylogger
factory in such a way that the loggers it creates will be logging to log4js
.
When using
log4js
, all logging except for warnings and errors is supressed by default. As such, you should make sure to set the log level to INFO or DEBUG as usual before expecting to see any output.
To activate the adapter, include it in your application entry point.
main.js
import adapter from 'anylogger-log4js'
import anylogger from 'anylogger'
import log4js from 'log4js'
adapter(anylogger, log4js)
main.js
const adapter = require('anylogger-log4js')
const anylogger = require('anylogger')
const log4js = require('log4js')
adapter(anylogger, log4js)
In your application module code, only use anylogger to stay framework independent:
my-module.js
import anylogger from 'anylogger'
const log = anylogger('my:module')
log('Logging is simple!')
This is helpful if you ever decide to factor out the application module into a separate library.
Because anylogger
is simply using log4js
below the surface, you can use
all the normal configuration mechanisms available for log4js
.
If you need to control log settings programmatically, just import log4js
and
use it directly:
main.js
// ...
import log4js from 'log4js'
log4js.getLogger('my:module').level = 'info'
// ...
Add an issue in this project's issue tracker to let me know of any problems you find, or questions you may have.
© 2024 by Stijn de Witt. Some rights reserved.
Licensed under the MIT Open Source license.
FAQs
Anylogger adapter for log4js
The npm package anylogger-log4js receives a total of 31 weekly downloads. As such, anylogger-log4js popularity was classified as not popular.
We found that anylogger-log4js 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.