Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Function 'logfile' assumes that filename is a string #430

@mborus

Description

@mborus
  • logzero version: 1.7.0
  • Python version: 3.9.9
  • Operating System: Windows 10

Description

in line 406 of 'init.,py' the function

def logfile(filename, ...

defines filename as a string (line 423)

  :arg string filename: Filename of the logfile. Set to `None` to disable logging to the logfile.

This causes problem with type checking, if you pass a Path (from python's pathlib), which is becoming more popular.

What I Did

Set a logfile using a pathlib Path

logzero.logfile(Path(LOGPATH, f"{mylog}.log"), maxBytes=1e6, backupCount=30)

I used PyCharm's "inspect code" feature and it flags this line as a type error.

Can you officially accept pathlib paths as a valid input so that type checking will work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions