Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes typing for logging level to accept both str and int #461

Merged
merged 2 commits into from
Dec 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions rich/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime
from logging import Handler, LogRecord
from pathlib import Path
from typing import ClassVar, List, Optional, Type
from typing import ClassVar, List, Optional, Type, Union

from . import get_console
from ._log_render import LogRender
Expand All @@ -21,7 +21,7 @@ class RichHandler(Handler):
under your control. If a dependency writes messages containing square brackets, it may not produce the intended output.

Args:
level (int, optional): Log level. Defaults to logging.NOTSET.
level (Union[int, str], optional): Log level. Defaults to logging.NOTSET.
console (:class:`~rich.console.Console`, optional): Optional console instance to write logs.
Default will use a global console instance writing to stdout.
show_time (bool, optional): Show a column for the time. Defaults to True.
Expand Down Expand Up @@ -55,7 +55,7 @@ class RichHandler(Handler):

def __init__(
self,
level: int = logging.NOTSET,
level: Union[int, str] = logging.NOTSET,
heavelock marked this conversation as resolved.
Show resolved Hide resolved
console: Console = None,
*,
show_time: bool = True,
Expand Down