Skip to main content

Parallel logging to console and logfile

Project description

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

  1. Download and unpack this repository.
  2. Open a terminal and navigate to the repository.
  3. Execute python setup.py install from 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.warn('This function illustrates how to use the duallog package.')
logging.warn('All messages are sent to both the console and a logfile in the folder \"{}\".'.format(logdir))
logging.warn('The logfile\'s name encodes the time when the program was started.')
logging.warn('The duallog package treats different log levels differently.')
logging.debug('Debug messages like this are written to the logfile, but not printed on screen.')
logging.info('Info messages like this get the same treatment.')
logging.warn('Warn messages like this one are important. They are both sent to the logfile and shown on screen.')
logging.error('The same holds for error messages like this one ...')
logging.critical('... and for critical messages, of course.')
logging.warn('Have a look at the debug and info messages the logfile in the folder \"{}\".'.format(logdir))
logging.warn('They are not sent to the screen in order not to clutter the display.')

The corresponding output on the console and in the logfile looks like this:

Duallog screenshot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duallog-0.13.tar.gz (3.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

duallog-0.13-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

duallog-0.13-py2-none-any.whl (4.6 kB view details)

Uploaded Python 2

File details

Details for the file duallog-0.13.tar.gz.

File metadata

  • Download URL: duallog-0.13.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.9.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for duallog-0.13.tar.gz
Algorithm Hash digest
SHA256 603bdd959391447a9275c4d4e7d43b22f5b3559aaf57f6f6457272e4b4ffb3a6
MD5 cec944a623c60ac2345b14493241ddb8
BLAKE2b-256 f1d9b996777ffb5e67b80bafc0f50afc4c280725348da5cc9702f0da0859a3f1

See more details on using hashes here.

File details

Details for the file duallog-0.13-py3-none-any.whl.

File metadata

  • Download URL: duallog-0.13-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.9.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for duallog-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 cf63c83f93834a76f69c2e052399b3560d3318e0db666210f37eccfc2bfef6aa
MD5 9c35989629c9d9c72c256e919dafc0b7
BLAKE2b-256 24fb9e4420a89b19b4813b1f5040cbe56465848dc4f548df486bbb8b85b5a500

See more details on using hashes here.

File details

Details for the file duallog-0.13-py2-none-any.whl.

File metadata

  • Download URL: duallog-0.13-py2-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.9.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for duallog-0.13-py2-none-any.whl
Algorithm Hash digest
SHA256 9c0911e05ba759210c8b74649473856dbc3809fb51d8a953336be2b58105a64b
MD5 140d6b2f17aff660f93a285ded6d7525
BLAKE2b-256 4faf350bdf3bcc8ac358d07d568f5558e29668337d8beadd56239edd7c45db84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page