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.

Duallog screenshot

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 output of this program is shown in the screenshot at the top of this page.

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.14.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.14-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: duallog-0.14.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.14.tar.gz
Algorithm Hash digest
SHA256 fc42c6386615055220628e7adb808ef98d3c11052cab14cd0c90bb73c677bc59
MD5 1ab03e63e5f6faae988ea203a85c3620
BLAKE2b-256 5fb3eeba96d08e7b66c8d527eb5e0f91ef3c8104781d567d3be65d577d4ac16c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: duallog-0.14-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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 de8e32e6441bb3a1f7f47eb1f6b24d069a256eb2fb53a428f95a69007bfb40d2
MD5 a529a7868be01a803f0975b534ec65a7
BLAKE2b-256 1d2cbfc769f9f0cc812ea650197ca3262ad2a72f4cb4a9c7a5aa3736e4a9cace

See more details on using hashes here.

File details

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

File metadata

  • Download URL: duallog-0.14-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.14-py2-none-any.whl
Algorithm Hash digest
SHA256 e636b6fce99453564b5f19b7825f4c94f66f290e1beec3e575d954c28f252c9d
MD5 1fa053494daff6f6654c51cbb655fb94
BLAKE2b-256 5343ab09fe3ff4d8406270a27ff96a571d40c2a3875caef5584909ad782d3094

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