Skip to main content

Classed based logger for Python

Project description

Class Based Logger for Python

Installation

pip install tdlogging

Usage

tdlogger.txt

  • exception log exceptions
  • count log count
  • time log time elapsed
  • return log return value
  • exec log count, time, and return
# fib.py

from tdlogging.tdlogger import create_logger

logger = create_logger(path="/path/to/tdlogger.txt/")

@logger.get_logger()
class Fib:
    @staticmethod
    def get_n(n):
        a = 0
        b = 1

        if n == 0:
            return a
        elif n == 1:
            return b
        else:
            for i in range(2, n):
                c = a + b
                a = b
                b = c
            return b

Fib.get_n(9)
> python fib.py

┎──────────TDLogger──────────┒
┃  --Method get_n Executed-- ┃
┃ Arguments: {               ┃
┃     'n': 9,                ┃
┃ }                          ┃
┃ Times Executed: 1          ┃
┃ Execution Time: 0.000s     ┃
┃ Return Value: 21           ┃
┃ Return Type: <class 'int'> ┃
┖────────────────────────────┚

Change log

[0.0.4] - 2020-04-02

Fixed unable to install

[0.0.3] - 2020-04-02

Fixed Markdown file

[0.0.2] - 2020-04-02

Added

  • tdprinter.py

Edited

  • tdprinter.py
  • tdlogger.py

[0.0.1] - 2020-04-01

Added

  • tdlogger.py
  • HISTORY.md
  • README.md

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

tdlogging-0.0.4.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

tdlogging-0.0.4-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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