Python debug logging helpers
Project description
debug_this
Python debug logging helpers
@debug_this.fucking_function
This decorator can be used to log the execution of an unfriendly function.
import logging
import debug_this
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
@debug_this.fucking_function(logger)
def example_function():
logger.info("This is an example function")
example_function()
The resulting logs should look like this:
DEBUG:__main__: >>> example_function
INFO:__main__:This is an example function
DEBUG:__main__: <<< example_function
@debug_this.fucking_class
This decorator can be used to log the execution of an unfriendly class.
import logging
import debug_this
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
@debug_this.fucking_class(logger)
class ExampleClass:
def __init__(self):
logger.info("Example constructor")
def example_method(self):
logger.info("Example method")
e = ExampleClass()
e.example_method()
The resulting logs should look like this:
DEBUG:__main__: >>> ExampleClass.__init__
INFO:__main__:Example constructor
DEBUG:__main__: <<< ExampleClass.__init__
DEBUG:__main__: >>> ExampleClass.example_method
INFO:__main__:Example method
DEBUG:__main__: <<< ExampleClass.example_method
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
debug_this-0.3.0.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for debug_this-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e012d39e537403c38dc4a500eeaae0bd1a3090fec9c7ae063c7d16daee011f |
|
MD5 | 165f87394c1bacf8d2b9dba6e72b7980 |
|
BLAKE2b-256 | 358097fd79ef4cfa1736d8147d0df49b2d3a08524cb5a9586c76ac30626e7d3a |