@@ -85,14 +85,14 @@ def __str__(self) -> str:
8585 :return: string representation for parameter. */** flags is attached if positional (*args) or keyword (**kwargs)
8686 :rtype: str
8787 """
88- # POSITIONAL_ONLY is only in precompiled functions
88+ # POSITIONAL_ONLY is only in precompiled functions or Python 3.8+
8989 if self .kind == self .POSITIONAL_ONLY : # pragma: no cover
9090 as_str : str = "" if self .name is None else f"<{ self .name } >"
9191 else :
9292 as_str = self .name or ""
9393
9494 # Add annotation if applicable (python 3 only)
95- if self .annotation is not self .empty : # pragma: no cover
95+ if self .annotation is not self .empty :
9696 as_str += f": { inspect .formatannotation (self .annotation )!s} "
9797
9898 value = self .value
@@ -145,7 +145,6 @@ def bind_args_kwargs(sig: inspect.Signature, *args: typing.Any, **kwargs: typing
145145 return result
146146
147147
148- # noinspection PyAbstractClass
149148class LogWrap (class_decorator .BaseDecorator ):
150149 """Base class for LogWrap implementation."""
151150
@@ -270,6 +269,7 @@ def _get_logger_for_func(self, func: FuncResultType) -> logging.Logger:
270269 def log_level (self ) -> int :
271270 """Log level for normal behavior.
272271
272+ :return: log level for normal behavior
273273 :rtype: int
274274 """
275275 return self .__log_level
@@ -290,6 +290,7 @@ def log_level(self, val: int) -> None:
290290 def exc_level (self ) -> int :
291291 """Log level for exceptions.
292292
293+ :return: log level for exceptions cases
293294 :rtype: int
294295 """
295296 return self .__exc_level
@@ -310,6 +311,7 @@ def exc_level(self, val: int) -> None:
310311 def max_indent (self ) -> int :
311312 """Maximum indentation.
312313
314+ :return: maximum allowed identation before switch to normal repr
313315 :rtype: int
314316 """
315317 return self .__max_indent
@@ -330,6 +332,7 @@ def max_indent(self, val: int) -> None:
330332 def blacklisted_names (self ) -> typing .List [str ]:
331333 """List of arguments names to ignore in log.
332334
335+ :return: list of arguments to ignore in log
333336 :rtype: typing.List[str]
334337 """
335338 return self .__blacklisted_names
@@ -338,6 +341,7 @@ def blacklisted_names(self) -> typing.List[str]:
338341 def blacklisted_exceptions (self ) -> typing .List [typing .Type [Exception ]]:
339342 """List of exceptions to re-raise without log traceback and text.
340343
344+ :return: list of exceptions to re-raise silent
341345 :rtype: typing.List[typing.Type[Exception]]
342346 """
343347 return self .__blacklisted_exceptions
@@ -346,6 +350,7 @@ def blacklisted_exceptions(self) -> typing.List[typing.Type[Exception]]:
346350 def log_call_args (self ) -> bool :
347351 """Flag: log call arguments before call.
348352
353+ :return: log cal arguments before call
349354 :rtype: bool
350355 """
351356 return self .__log_call_args
@@ -366,6 +371,7 @@ def log_call_args(self, val: bool) -> None:
366371 def log_call_args_on_exc (self ) -> bool :
367372 """Flag: log call arguments on exception.
368373
374+ :return: log call arguments in case of exception logging
369375 :rtype: bool
370376 """
371377 return self .__log_call_args_on_exc
@@ -386,6 +392,7 @@ def log_call_args_on_exc(self, val: bool) -> None:
386392 def log_traceback (self ) -> bool :
387393 """Flag: log traceback on exception.
388394
395+ :return: log traceback in case of exception logging
389396 :rtype: bool
390397 """
391398 return self .__log_traceback
@@ -406,6 +413,7 @@ def log_traceback(self, val: bool) -> None:
406413 def log_result_obj (self ) -> bool :
407414 """Flag: log result object.
408415
416+ :return: log execution result object
409417 :rtype: bool
410418 """
411419 return self .__log_result_obj
@@ -426,6 +434,7 @@ def log_result_obj(self, val: bool) -> None:
426434 def _logger (self ) -> typing .Optional [logging .Logger ]:
427435 """Logger instance.
428436
437+ :return: logger instance if configured
429438 :rtype: typing.Optional[logging.Logger]
430439 """
431440 return self .__logger
@@ -434,6 +443,7 @@ def _logger(self) -> typing.Optional[logging.Logger]:
434443 def _spec (self ) -> typing .Optional [typing .Callable [..., FuncResultType ]]:
435444 """Spec for function arguments.
436445
446+ :return: function specification to grab information from
437447 :rtype: typing.Callable
438448 """
439449 return self .__spec
@@ -560,8 +570,11 @@ def _get_func_args_repr(
560570 def _make_done_record (self , logger : logging .Logger , func_name : str , result : typing .Any ) -> None :
561571 """Construct success record.
562572
573+ :param logger: logger instance to use
563574 :type logger: logging.Logger
575+ :param func_name: function name
564576 :type func_name: str
577+ :param result: function execution result
565578 :type result: typing.Any
566579 """
567580 msg : str = f"Done: { func_name !r} "
@@ -573,19 +586,27 @@ def _make_done_record(self, logger: logging.Logger, func_name: str, result: typi
573586 def _make_calling_record (self , logger : logging .Logger , name : str , arguments : str , method : str = "Calling" ) -> None :
574587 """Make log record before execution.
575588
589+ :param logger: logger instance to use
576590 :type logger: logging.Logger
591+ :param name: function name
577592 :type name: str
593+ :param arguments: function arguments repr
578594 :type arguments: str
595+ :param method: "calling" or "awaiting"
579596 :type method: str
580597 """
581598 logger .log (level = self .log_level , msg = f"{ method } : \n { name } ({ arguments if self .log_call_args else '' } )" )
582599
583600 def _make_exc_record (self , logger : logging .Logger , name : str , arguments : str , exception : Exception ) -> None :
584601 """Make log record if exception raised.
585602
603+ :param logger: logger instance to use
586604 :type logger: logging.Logger
605+ :param name: function name
587606 :type name: str
607+ :param arguments: function arguments repr
588608 :type arguments: str
609+ :param exception: exception captured
589610 :type exception: Exception
590611 """
591612 exc_info = sys .exc_info ()
0 commit comments