Logging
In alchemlyb, we use loguru for logging. By default, the
loguru will print the logging information into the
sys.stderr.
Print to the stderr
If you want to customise the printing to the stderr, you could remove the existing sink first
from loguru import logger
logger.remove()
Then add other custom sink
logger.add(sys.stderr, format="{time} {level} {message}", level="INFO")
The loguru logger is compatible with the logging module of the Python
standard library and can easily be
configured to log to a logging handler.
Save to a file
Alternatively, one could save to a file simply with
from loguru import logger
logger.add("file_{time}.log")
See configure to log to a file for more explanation.