Pyhunt is a lightweight logging tool designed to enhance debugging through visually structured logs. By applying a simple decorator, functions and methods can automatically trace their execution flow, making it easier to understand asynchronous programming and AI-generated code. Its tree-structured, color-coded logs improve readability and support multiple log levels for effective monitoring.
pyhunt is a lightweight logging tool designed to enhance Python code quality through visual call tracing and structured logging. Ideal for both standard and AI-generated codebases, it simplifies debugging by allowing developers to add a simple decorator to their functions, automatically generating organized, color-coded logs in the terminal.
@trace decorator.HUNT_LEVEL within a .env file for better environment management.Set the logging level with:
hunt
This command initializes the HUNT_LEVEL to DEBUG in your .env file.
To utilize the tracing functionality, simply decorate your functions or classes:
from pyhunt import trace
@trace
def test(value):
return value
@trace
async def test(value):
return value
@trace
class MyClass:
def first_method(self, value):
return value
def second_method(self, value):
return value
Although the logger interface is available, the recommended approach is to rely on the @trace decorator for most logging needs to maintain clarity and readability. For situations requiring more granular control, use the logger as follows:
from pyhunt import logger
logger.debug("This is a debug log.")
logger.info("This is an info log.")
logger.warning("This is a warning log.")
logger.error("This is an error log.")
logger.critical("This is a critical log.")
Execute commands with logging options using:
hunt [options]
--debug: Activate DEBUG level logging for detailed insights--info: Use INFO level for standard logging--warning: Switch to WARNING level for potential issues--error: Log ERROR level messages for serious problems--critical: Log CRITICAL level events for immediate attentionIf no specific option is chosen, the default log level is set to INFO.
No comments yet.
Sign in to be the first to comment.