
Product
Go Support Is Now Generally Available
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
anylogger-debug
Advanced tools
.
This is an anylogger adapter for debug.
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 debug
as their logging framework.
Install both anylogger
and debug
, as well as this adapter:
npm install --save anylogger debug anylogger-debug
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-debug adapter will modify the anylogger
factory in such a way that the loggers it creates will be logging to debug
. As such, you should make sure to activate debug mode with the environment variable or localStorage key as usual before expecting to see any output.
To activate the adapter, include it in your application entry point.
main.js
require('anylogger-debug')
main.js
import 'anylogger-debug'
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 debug
below the surface, you can use
all the normal configuration mechanisms available for debug
.
If you need to control log settings programmatically, just import debug
and
use it directly:
main.js
// ...
import debug from 'debug'
debug.enable('my-module')
// ...
I suggest using debug's build-in configuration mechanism via environment variables and localstorage lookup keys instead of doing it from code.
Add an issue in this project's issue tracker to let me know of any problems you find, or questions you may have.
© 2019 by Stijn de Witt. Some rights reserved.
Licensed under the MIT Open Source license.
FAQs
Anylogger adapter for debug
The npm package anylogger-debug receives a total of 70 weekly downloads. As such, anylogger-debug popularity was classified as not popular.
We found that anylogger-debug 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.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
Security News
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.