From da9e51e4020f9e414c4a1f34903601d3ed9f5381 Mon Sep 17 00:00:00 2001 From: Delgan Date: Fri, 27 Dec 2019 09:54:13 +0100 Subject: [PATCH] Correct an inaccuracy in docs to add a new level --- loguru/__init__.pyi | 4 +++- loguru/_logger.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/loguru/__init__.pyi b/loguru/__init__.pyi index 9a661c9e..d60a585b 100644 --- a/loguru/__init__.pyi +++ b/loguru/__init__.pyi @@ -282,7 +282,9 @@ class Logger: @overload def level(self, name: str) -> Level: ... @overload - def level(self, name: str, no: int = ..., color: str = ..., icon: str = ...) -> Level: ... + def level( + self, name: str, no: int = ..., color: Optional[str] = ..., icon: Optional[str] = ... + ) -> Level: ... @overload def level( self, diff --git a/loguru/_logger.py b/loguru/_logger.py index b0169d78..2a7365a1 100644 --- a/loguru/_logger.py +++ b/loguru/_logger.py @@ -1355,11 +1355,12 @@ def level(self, name, no=None, color=None, icon=None): """Add, update or retrieve a logging level. Logging levels are defined by their ``name`` to which a severity ``no``, an ansi ``color`` - and an ``icon`` are associated and possibly modified at run-time. To |log| to a custom + tag and an ``icon`` are associated and possibly modified at run-time. To |log| to a custom level, you should necessarily use its name, the severity number is not linked back to levels name (this implies that several levels can share the same severity). - To add a new level, all parameters should be passed so it can be properly configured. + To add a new level, its ``name`` and its ``no`` are required. A ``color`` and an ``icon`` + can also be specified or will be empty by default. To update an existing level, pass its ``name`` with the parameters to be changed.