[elbe-devel] [PATCH 1/2] log: allow to reset the max_level via reset_level()

Bastian Germann bage at linutronix.de
Wed Oct 16 17:52:27 CEST 2019


> when a project has seen an error, and that has been reported, it
> must be possible to reset the logging max level.
> 
> implement elbepack.log.reset_level()
> 
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>

Reviewed-by: Bastian Germann <bage at linutronix.de>

> ---
>  elbepack/log.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/elbepack/log.py b/elbepack/log.py
> index 643ac1eec..2546a3b7b 100644
> --- a/elbepack/log.py
> +++ b/elbepack/log.py
> @@ -59,6 +59,12 @@ class QHandler(logging.Handler):
>          except (IndexError, KeyError):
>              return logging.NOTSET
>  
> +    @classmethod
> +    def reset_level(cls, target):
> +        try:
> +            cls.queues[target].max_level = logging.NOTSET
> +        except (IndexError, KeyError):
> +            pass
>  
>  def read_loggingQ(proj):
>      return QHandler.pop(proj)
> @@ -67,6 +73,8 @@ def read_loggingQ(proj):
>  def read_maxlevel(proj):
>      return QHandler.max_level(proj)
>  
> +def reset_level(proj):
> +    QHandler.reset_level(proj)
>  
>  class ThreadFilter(logging.Filter):
>  
> 



More information about the elbe-devel mailing list