Skip to content

Commit

Permalink
Correct an inaccuracy in docs to add a new level
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Dec 27, 2019
1 parent 256875a commit da9e51e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion loguru/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions loguru/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit da9e51e

Please sign in to comment.