## 5.5 Logging and Verbosity

We use the lgr package for logging and progress output.

Because lgr comes with its own exhaustive vignette, we will just briefly give examples how you can change the most important settings related to logging in mlr3.

### 5.5.1 Available logging levels

lgr comes with certain numeric thresholds which correspond to verbosity levels of the logging. For mlr3 the default is set to 400 which corresponds to level “info”. The following ones are available:

library("lgr")
getOption("lgr.log_levels")
## fatal error  warn  info debug trace
##   100   200   300   400   500   600

### 5.5.2 Global Setting

lgr comes with a global option called "lgr.default_threshold" which can be set via options(). You can set a specific level in your .Rprofile which is then used for all packages that use the lgr package. This approach may not be desirable if you want to only change the logging level for mlr3.

### 5.5.3 Changing mlr3 logging levels

To change the setting for mlr3 only, you need to change the threshold of the mlr3 logger like this:

lgr::get_logger("mlr3")\$set_threshold("<level>")

Remember that this change only applies to the current R session.