Skip to content

Commit

Permalink
Allow to configure logging of traceback. Bump to 4.9.2 (#50)
Browse files Browse the repository at this point in the history
* [x] covered by dedicated unit test
* [x] documentation updated

* drop CHANGELOG as useless

(cherry picked from commit a784811)
  • Loading branch information
penguinolog committed Oct 2, 2018
1 parent 23a70c7 commit 1e89fcf
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 285 deletions.
277 changes: 0 additions & 277 deletions CHANGELOG.rst

This file was deleted.

2 changes: 2 additions & 0 deletions README.rst
Expand Up @@ -80,6 +80,7 @@ Argumented usage with arguments from signature:
blacklisted_exceptions=None, # Exceptions to skip in log
log_call_args=True, # Log call arguments before call
log_call_args_on_exc=True, # Log call arguments if exception happens
log_traceback: bool = True, # Log traceback if exception happens
log_result_obj=True, # Log result object
)
Expand Down Expand Up @@ -181,6 +182,7 @@ Example construction and read from test:
log_call.blacklisted_exceptions == []
log_call.log_call_args == True
log_call.log_call_args_on_exc == True
log_call.log_traceback == True
log_call.log_result_obj == True
On object change, variable types is validated.
Expand Down
6 changes: 5 additions & 1 deletion doc/source/logwrap.rst
Expand Up @@ -12,7 +12,7 @@ API: Decorators: `LogWrap` class and `logwrap` function.

.. versionadded:: 2.2.0

.. py:method:: __init__(func=None, *, log=logging.getLogger('logwrap'), log_level=logging.DEBUG, exc_level=logging.ERROR, max_indent=20, spec=None, blacklisted_names=None, blacklisted_exceptions=None, log_call_args=True, log_call_args_on_exc=True, log_result_obj=True, )
.. py:method:: __init__(func=None, *, log=logging.getLogger('logwrap'), log_level=logging.DEBUG, exc_level=logging.ERROR, max_indent=20, spec=None, blacklisted_names=None, blacklisted_exceptions=None, log_call_args=True, log_call_args_on_exc=True, log_traceback=True, log_result_obj=True, )
:param func: function to wrap
:type func: typing.Optional[typing.Callable]
Expand Down Expand Up @@ -43,12 +43,15 @@ API: Decorators: `LogWrap` class and `logwrap` function.
:type log_call_args: bool
:param log_call_args_on_exc: log call arguments if exception raised.
:type log_call_args_on_exc: bool
:param log_traceback: log traceback on excaption in addition to failure info
:type log_traceback: bool
:param log_result_obj: log result of function call.
:type log_result_obj: bool

.. versionchanged:: 3.3.0 Extract func from log and do not use Union.
.. versionchanged:: 3.3.0 Deprecation of `*args`
.. versionchanged:: 4.0.0 Drop of `*args`
.. versionchanged:: 4.9.2 log_traceback parameter

.. py:method:: pre_process_param(self, arg)
Expand Down Expand Up @@ -92,6 +95,7 @@ API: Decorators: `LogWrap` class and `logwrap` function.
``typing.List[typing.Type[Exception]]``, modified via mutability
.. py:attribute:: log_call_args
.. py:attribute:: log_call_args_on_exc
.. py:attribute:: log_traceback
.. py:attribute:: log_result_obj
.. py:attribute:: _func
Expand Down
2 changes: 1 addition & 1 deletion logwrap/__init__.py
Expand Up @@ -37,7 +37,7 @@
"bind_args_kwargs",
)

__version__ = "4.9.1"
__version__ = "4.9.2"
__author__ = "Alexey Stepanov"
__author_email__ = "penguinolog@gmail.com"
__maintainers__ = {
Expand Down

0 comments on commit 1e89fcf

Please sign in to comment.