API: LogOnAccess

class logwrap.LogOnAccess(property)[source]

Property with logging on successful get/set/delete or failure.

New in version 6.1.0.

__init__(fget=None, fset=None, fdel=None, doc=None, *, logger=None, log_object_repr=True, log_level=logging.DEBUG, exc_level=logging.DEBUG, log_before=True, log_success=True, log_failure=True, log_traceback=True, override_name=None)[source]
Parameters:
  • fget (typing.Optional[typing.Callable[[typing.Any, ], typing.Any]]) – normal getter.
  • fset (typing.Optional[typing.Callable[[typing.Any, typing.Any], None]]) – normal setter.
  • fdel (typing.Optional[typing.Callable[[typing.Any, ], None]]) – normal deleter.
  • doc (typing.Optional[str]) – docstring override
  • logger (typing.Optional[typing.Union[logging.Logger, str]]) – logger instance or name to use as override
  • log_object_repr (bool) – use repr over object to describe owner if True else owner class name and id
  • log_level (int) – log level for successful operations
  • exc_level (int) – log level for exceptions
  • log_before (bool) – log before operation
  • log_success (bool) – log successful operations
  • log_failure (bool) – log exceptions
  • log_traceback (bool) – Log traceback on exceptions
  • override_name (typing.Optional[str]) – override property name if not None else use getter/setter/deleter name
getter(fget)

Descriptor to change the getter on a property.

Parameters:fget (typing.Optional[typing.Callable[[typing.Any, ], typing.Any]]) – new normal getter.
Return type:AdvancedProperty
setter(fset)

Descriptor to change the setter on a property.

Parameters:fset (typing.Optional[typing.Callable[[typing.Any, typing.Any], None]]) – new setter.
Return type:AdvancedProperty
deleter(fdel)

Descriptor to change the deleter on a property.

Parameters:fdel (typing.Optional[typing.Callable[[typing.Any, ], None]]) – New deleter.
Return type:AdvancedProperty
fget

typing.Optional[typing.Callable[[typing.Any, ], typing.Any]] Getter instance.

fset

typing.Optional[typing.Callable[[typing.Any, typing.Any], None]] Setter instance.

fdel

typing.Optional[typing.Callable[[typing.Any, ], None]] Deleter instance.

logger

typing.Optional[logging.Logger] Logger instance to use as override.

log_object_repr

bool Use repr over object to describe owner if True else owner class name and id.

log_level

int Log level for successful operations.

exc_level

int Log level for exceptions.

log_before

bool Log before operation

log_success

bool Log successful operations.

log_failure

bool Log exceptions.

log_traceback

bool Log traceback on exceptions.

override_name

typing.Optional[str] Override property name if not None else use getter/setter/deleter name.