logzero
logzero copied to clipboard
Function 'logfile' assumes that filename is a string
- 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?