Skip to main content

A logging package for tracing function calls with error handling and email notification

Project description

TrackLogging

TrackLogging is a logging package for tracing function calls with error handling and email notification.

Installation

You can install TrackingLog using pip:

pip install trackinglog

Github URL

https://github.com/shiyi-yinghao/trackinglog

PyPi URL

https://pypi.org/project/trackinglog/

version History

0.1.0 Package Draft created

0.1.1 Decorator get_log and directly object creator get_logger created. Added setup check decorator. Added p-functions(print and log).

0.1.2 Added error handling. Added verbose option for decorator. Added called function name.

0.1.3 Added profiler for both function level and line level. Updated error handling logic: reset verbose to False, but it will now raise error instead. Added class name to log. Added dependency pakages. Added resource performance tracking.

0.1.4 Formatted the logging message with indentation. Add print to log feature. Refactor the get_log function.

0.1.5 AddED cache log cleaner.

Feature in developing

Add public and private log

Add email notification

Add Kafka message notification

Uaage for function:

import logging
import trackinglog
import inspect

# Setup the LogManager with root logging path
trackinglog.logger.setup(root_log_path='./logs')

@trackinglog.logger.get_log('my_logger', verbose=1, enable_profiling="line")
def my_function(log=None):  # Notice how the log parameter is expected
    log.info("This function does something important.")
    print("Function is executing...")
    assert False, "This function is broken!"
    
my_function()  # Running the function will log start and end, using the specific logger

Usage for class:

@trackinglog.logger.get_log('my_logger_cls', verbose=1, enable_profiling="line", print2log=True)
class testclass:
    def __init__(self, a: int):
        self.a=a
    def p(self):
        self.log.info("class log")
        assert False , "This function is broken!"

    def count(self, n: int):
        for i in range(n):
            print(i)
    

t=testclass(2.2)
t.p()
t.count(3)

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

trackinglog-0.1.5.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

trackinglog-0.1.5-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file trackinglog-0.1.5.tar.gz.

File metadata

  • Download URL: trackinglog-0.1.5.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for trackinglog-0.1.5.tar.gz
Algorithm Hash digest
SHA256 29e5eb891467da429c9f347f0709d46b833a99c0be8f7cf4de165635eb863e43
MD5 6639b2115bcfb58d363eb8d88c4b1b46
BLAKE2b-256 980f463ec9de6d0347ab4d64dd7acb4c13aac652bcdb745e478026e75f6d314c

See more details on using hashes here.

File details

Details for the file trackinglog-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: trackinglog-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for trackinglog-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e8393a03831d0b8e99c6911f7978c6004a1bd584e882cc5d6b36848fd4f6b1b8
MD5 408e909c1d4e7dffd564de16c99af265
BLAKE2b-256 8b4d5c05122661bf3559c18af308284c78a0a0c1fdfda74c886eb8d03f134ddd

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