Skip to content

Record type bug #1482

Description

@triple-raze
from loguru import Record

def func(record: Record) -> None:
    print(record)  # using in any function, forcing mypy to do typecheck
mypy: Expression type contains "Any" (has type "Record")

its because of

class Record(TypedDict):
    elapsed: timedelta
    exception: Optional[RecordException]
    # \/\/\/\/\/\/\/\/\/\/
    extra: Dict[Any, Any]
    # /\/\/\/\/\/\/\/\/\/\ 
    file: RecordFile
    function: str
    level: RecordLevel
    line: int
    message: str
    module: str
    name: Optional[str]
    process: RecordProcess
    thread: RecordThread
    time: datetime

maybe separate Record and Record with context or something like that?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to an already existing feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions