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 hashes)

Uploaded Source

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