Node-Virtualization / node-virtualbox

A JavaScript Library for Interacting with VirtualBox
MIT License
259 stars 68 forks source link

Configuration-Option to suppress any Log-Output #70

Closed pharma4u-awahl closed 4 years ago

pharma4u-awahl commented 4 years ago

This would be great, to have a configuration option to suppress any logger output. 🥰

[2020-05-16 01:47:10.448] [INFO] VirtualBox - Virtualbox version detected as 5

You're using an old log4js version, this makes it hard to set the logLvele() within peerDependencies.

I like this module!

colonelpopcorn commented 4 years ago

I think the best way to implement this is to have a default log4js config as a constructor parameter in a class based version of this module. Stay tuned!

pharma4u-awahl commented 4 years ago

yes, maybe something like this

const virtualbox = require('virtualbox')({
   logLevel: 0
   // or
   quite: true
});
colonelpopcorn commented 4 years ago

@pharma4u-awahl Hi! the v1.1.0 release has fixed this issue. We opted to go for an interface based way of injecting a constructor so if you want to suppress log output you'll have to do the following:

const virtualbox = require('virtualbox').create({
  log: function() {},
  info: function() {},
  debug: function() {},
})

Alternatively, you can pass in your own logger, so long as it has a method called info, debug, and log. Hope this helps!