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

Uploaded Python 3

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: duallog-0.12.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.12.tar.gz
Algorithm Hash digest
SHA256 c4ca7a57b6db7ddef28c69c0f6feb91f4905cd6fa47f5f642649a6338f69c186
MD5 fc27956f52401496f972e1994b989c28
BLAKE2b-256 4191a336500c69c57b8f7cccd26c0959444601cd8333c1e2cd8ce381c628d3df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: duallog-0.12-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.12-py3-none-any.whl
Algorithm Hash digest
SHA256 d46c7289b3fe900f65e752df476b3640992a46f071626b81eec9b5e59d201396
MD5 6ec856e9095e43ae31a3b0738e287519
BLAKE2b-256 c37ffbcbd90461ba1e2702bfa50c2ec05ecbadf2d2320940a90331e6f24285d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: duallog-0.12-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.12-py2-none-any.whl
Algorithm Hash digest
SHA256 70478a95a3fe0f83641d0bdfb5787a0d95f401b933c672a63421e5bd6d40d9e9
MD5 d714878503683cc267928fb49674cf90
BLAKE2b-256 f4ee45c35c4a6c2f3f71f94034a84a83c6080ac54c179f75826d010b29c6bc54

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