Delgan / loguru

Python logging made (stupidly) simple
MIT License
19.58k stars 694 forks source link

Log deletion too greedy #195

Closed gazpachoking closed 4 years ago

gazpachoking commented 4 years ago

Using the file sink, when loguru goes to clean up old logs due to retention setting. It is a bit too greedy with what it thinks are old logs. I am using the filename flexget.log, and the glob for deletion comes out to flexget.*. This strikes me as a bit greedy, and in my particular case it tries to delete a folder called FlexGet.egg-info (which is read only and causes a crash.) The two easy improvements I can see are:

Delgan commented 4 years ago

Good catch, thanks. The filenames can take many forms due to "{time}", rotation and compression. I will modify the collect of files based on your two suggestions. In the meantime, I guess you will need to manually re-filter and remove files using a custom retention function. :wink:

Delgan commented 4 years ago

Closed by #196.