Skip to main content

Logging package to enable writing all program information with corresponding datetime to multiple, DIFFERENT files safely when running multiple threads (multi-threading).

Project description

log-everywhere Python API

GitHub license GitHub stars GitHub forks
PyPI version
PyPI - Wheel PyPI - Format PyPI - Status
PyPI - Implementation PyPI - Python Version
codebeat badge

Installing the package

Enter the following in your command line:

# if something isn't working properly, try rerunning this
# the problem may have been fixed with a newer version

pip3 install -U log-everywhere     # MacOS/Linux
pip  install -U log-everywhere     # Windows
Using the log-everywhere package
python3     # MacOS/Linux
python      # Windows
from log_everywhere import yield_logger
from log_everywhere import log

def do_important_things(log_locations):
    num = 1 + 1
    log(f'This function calculated num to be: {num}', log_locations)
    product = num * 2
    log(f'This function calculated the product of num multiplied by 2 to be: {product}', log_locations)
    log( 'This function is now closing...', log_locations)

def main():
    with yield_logger('name_of_my_log_file', log_silently=False) as log_locations:
        do_important_things(log_locations)

main()

To see why Python Standard Library's logging module was insufficient and creating a custom logger was necessary, see this modification in the yt_videos_list package. NOTE that the exact implementation differed slighlty in this commit (yield_logger() was named yield_file_writer()), and support for logging to both the console AND the log file wasn't added until this commit

Direct link to commits:

To see more interesting logging modifications, see the significantly improves logging section nested within the details section of the yt_videos_list package 0.5.0 Release page!

Seeing all available functions for the log-everywhere package
python3     # MacOS/Linux
python      # Windows
import log_everywhere
help(log_everywhere.logger)

# OR

from log_everywhere import logger
help(logger)

# SEEING PACKAGE METADATA
import log_everywhere
help(log_everywhere)
Usage Statistics

PyPI - Daily Downloads PyPI - Weekly Downloads PyPI - Monthly Downloads
PePY Weekly Downloads PePY Monthly Downloads PePY Total Downloads

If you found this interesting or useful, please consider starring this repo on GitHub so other people can more easily find and use this. Thanks!

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

log_everywhere-0.0.1.tar.gz (9.7 kB view details)

Uploaded Source

File details

Details for the file log_everywhere-0.0.1.tar.gz.

File metadata

  • Download URL: log_everywhere-0.0.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for log_everywhere-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4c9bb1c8d14f1ecfe38c50316cf7a784be0d8c64e70657328d98b0b208d7337c
MD5 beb56bf04e17a00a75fa8ede32cf94c5
BLAKE2b-256 69b5a86c1248682573419ff05a644a884dcf62fa109d87d5d5ce842142b68527

See more details on using hashes here.

Supported by

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