I have been looking at the Logging and LoggingExtras packages to better understand how to use them. So I finally understand how to setup the logging messages and such.
One question that I was not clear on, was what is the best way to turn on logging for @debug messages. I can use the environment variable JULIA_DEBUG=all, but according to the docs, that is a quick and dirty way to do it. even for me, trying to export an environment variable and then remove that variable seems a bit risky?
So what is the correct way to do this. My use case is that while developing the package, I would like to run the package in debug mode or in standard mode interchangeably. I read a lot about the enhancements in the LoggingExtras package etc., but I was still not sure what the most standard or community approved method way to initiate debug messages.
In certain situations, you could also set up a custom logger with a specific log-level (possibly via LoggingExtras) . I routinely do this kind of thing for testing:
But any situation where I want to see@debug logs, I set the JULIA_DEBUG variable.
P.S.: I suppose with_logger(ConsoleLogger(stdout, Logging.Debug)) from the above example is a realistic alternative if you want to run a few lines of code in the REPL with @debug logging enabled.