
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
anylogger-loglevel
Advanced tools
.
This is an anylogger adapter for loglevel.
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 loglevel
as their logging framework.
index.html
<script src="https://unpkg.com/anylogger@1.1.0-beta.0/anylogger.min.js"></script>
<script src="https://unpkg.com/loglevel@1.9.1/dist/loglevel.min.js"></script>
<script src="https://unpkg.com/anylogger-loglevel@1.1.0-beta.0/anylogger-loglevel.min.js"></script>
<script>(function(){ // IIFE
var log = anylogger('index.html')
log.info('Logging is simple!')
// to see logging, enable it by typing this in the console:
// localStorage.setItem('loglevel:index.html', 'DEBUG')
// then refresh the page
})()</script>
When used in the browser with global names (like when used from CDN as in the example above),
loglevel
publishes itself towindow.log
, notwindow.loglevel
as one might expect.
Install this adapter, as well as both anylogger
and loglevel
:
npm install --save anylogger-loglevel anylogger loglevel
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-loglevel
adapter will modify the anylogger
factory in such a way that the loggers it creates will be logging to loglevel
.
When using
loglevel
, 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
require('anylogger-loglevel')
main.js
import 'anylogger-loglevel'
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 loglevel
below the surface, you can use
all the normal configuration mechanisms available for loglevel
.
If you need to control log settings programmatically, just import loglevel
and
use it directly:
main.js
// ...
import loglevel from 'loglevel'
loglevel.getLogger('my-module').setLevel(loglevel.levels.INFO)
// ...
Add an issue in this project's issue tracker to let me know of any problems you find, or questions you may have.
© 2020 by Stijn de Witt. Some rights reserved.
Licensed under the MIT Open Source license.
The GZIP algorithm is available in different flavours and with different possible compression settings. The sizes quoted in this README have been measured using gzip-size by Sindre Sorhus, your mileage may vary.
FAQs
Anylogger adapter for loglevel
The npm package anylogger-loglevel receives a total of 71 weekly downloads. As such, anylogger-loglevel popularity was classified as not popular.
We found that anylogger-loglevel 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.