Debugging¶
All applications use some kind of debugging.
Functions¶
-
debugging.
ModuleLogger
(globs)¶ Parameters: globs – dictionary of module globals This function, posing as an instance creator, returns a ...
Function Decorators¶
-
debugging.
function_debugging
()¶ This function decorates a function with instances of buggers that are named by the function name combined with the module name. It is used like this:
@function_debugging def some_function(arg): if _debug: some_function._debug("some_function %r", arg) # rest of code
This results in a bugger called module.some_function that can be accessed by that name when attaching log handlers.
Note
This should really be called debug_function or something like that.
Classes¶
-
class
debugging.
DebugContents
¶ This is a long line of text.
-
_debug_contents
¶ This is a long line of text.
-
debug_contents
(indent=1, file=sys.stdout, _ids=None)¶ Parameters: - indent – function to call
- file – regular arguments to pass to fn
- _ids – keyword arguments to pass to fn
This is a long line of text.
-
-
class
debugging.
LoggingFormatter
(logging.Formatter)¶ This is a long line of text.
-
__init__
()¶ This is a long line of text.
-
format
(record)¶ Parameters: record (logging.LogRecord) – record to format This function converts the record into a string. It uses the regular formatting function that it overrides, then if any of the parameters inherit from
DebugContents
(or duck typed by providing a debug_contents function) the message is extended with the deconstruction of those parameters.
-
-
class
debugging.
Logging
¶ This is a long line of text.
Note
Now that Python supports class decorators, this should really be a class decorator called debug_class or something like that.