Skip to main content

quick method log/exception catching

Project description

qqlog install

pip install qqlog

qqlog example

from qqlog import ex,init,enterleave,trace
import logging
# init(path='./log/qqlog.log',level=logging.DEBUG)
init()
@ex()
def test1(a,b):
    return a/b

@enterleave()
def test2(a,b):
    return a/b    

@trace()
def test3(a,b):
    return a/b

try:
    test1(1,0)
    test2(1,1)
    test3(1,0)
except Exception as ex:
    print(ex)

Console/qqlog.log

2021-09-26 14:00:04 [ERROR] [MainThread] [RAISE]test1: division by zero
2021-09-26 14:00:04 [DEBUG] [MainThread] [ENTER]test2((1, 1){})
2021-09-26 14:00:04 [DEBUG] [MainThread] [RETURN]test2(1.0)
2021-09-26 14:00:04 [ERROR] [MainThread] [RAISE]test3
****************************************TRACE START****************************************
Traceback (most recent call last):
  File "E:\jupyter\projects\whl\qqlog\qqlog\__init__.py", line 104, in func_warp
    return_val = func(*args, **kwargs)
  File "E:\jupyter\projects\whl\qqlog\example.py", line 16, in test3
    return a/b
ZeroDivisionError: division by zero

****************************************TRACE END****************************************

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

qqlog-0.0.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

qqlog-0.0.1-py3-none-any.whl (3.6 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