
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
anylogger-diary
Advanced tools
.
..
This is an anylogger adapter for Diary.
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 Diary as their logging framework.
index.html
<script src="https://unpkg.com/anylogger@1.0.3/anylogger.min.js"></script>
<script src="https://unpkg.com/diary@1.6.8/dist/diary.min.js"></script>
<script src="https://unpkg.com/anylogger-diary@1.0.0/anylogger-diary.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('diary:index.html', 'DEBUG')
  // then refresh the page
})()</script>
Install this adapter, as well as both anylogger and Diary:
npm install --save anylogger-diary anylogger diary
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-diary adapter will modify the anylogger factory in such a way that the loggers it creates will be logging to diary.
When using
diary, 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-diary')
main.js
import 'anylogger-diary'
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 diary below the surface, you can use
all the normal configuration mechanisms available for diary.
If you need to control log settings programmatically, just import diary and
use it directly:
main.js
// ...
import diary from 'diary'
diary.getLogger('my-module').setLevel(diary.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.
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 Diary
The npm package anylogger-diary receives a total of 1 weekly downloads. As such, anylogger-diary popularity was classified as not popular.
We found that anylogger-diary 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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.