Parallel logging to console and logfile
The duallog package
Python package to enable simultaneous logging to console and logfile.
How to install duallog?
You can install duallog using pip, or you can install from source. Below you find instructions for both ways.
Installation via pip
In the terminal, run
pip install duallog.
Installation from source
- Download and unpack this repository.
- Open a terminal and navigate to the repository.
python setup.py installfrom within the repository.
How to use duallog?
Using duallog is very simple, as illustrated in the following minimal example script.
# Import the duallog package to set up simultaneous logging to screen and console. import duallog # Import the logging package to generate log messages. import logging # Set up dual logging and tell duallog where to store the logfiles. duallog.setup('logtest') # Generate some log messages. logging.debug('Debug messages are only sent to the logfile.') logging.info('Info messages are not shown on the console, too.') logging.warning('Warnings appear both on the console and in the logfile.') logging.error('Errors get the same treatment.') logging.critical('And critical messages, of course.')
The output of this program is shown in the screenshot at the top of this page.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size duallog-0.20-py2-none-any.whl (4.2 kB)||File type Wheel||Python version py2||Upload date||Hashes View|
|Filename, size duallog-0.20.tar.gz (3.1 kB)||File type Source||Python version None||Upload date||Hashes View|