Timeline for answer to Python logging: display only information from debug level by zmo
Current License: CC BY-SA 4.0
Post Revisions
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 9, 2021 at 20:58 | comment | added | Prosy A. | Hello, @zmo would you care to answer this question related to this problem? stackoverflow.com/q/67460075/12415287 | |
| Oct 21, 2020 at 14:21 | history | edited | Marius Retegan | CC BY-SA 4.0 |
fixed wrong code and minor spelling
|
| Mar 4, 2014 at 11:39 | history | edited | zmo | CC BY-SA 3.0 |
edited body
|
| Dec 2, 2013 at 21:10 | comment | added | zmo |
indeed, that would work out, though I don't think this is appropriate. As a general rule, simpler is better, and you anyway need a FileHandler to do the job, so there's no need to add another instance to handle that. And as the documentation you've linked states: Although filters are used primarily to filter records based on more sophisticated criteria than levels [...], i.e. it can do it, but it's been design for more than just that.
|
|
| Nov 28, 2013 at 14:11 | comment | added | glglgl | Wouldn't it be more appropriate to create a filter object and attach it to the handler? | |
| Jun 15, 2013 at 17:26 | history | edited | zmo | CC BY-SA 3.0 |
added 8 characters in body
|
| Jun 15, 2013 at 17:26 | comment | added | zmo | indeed, I misread the documentation, thank you for spotting it, I'm updating my answer | |
| Jun 15, 2013 at 14:50 | comment | added | Marijke Luttekes |
For future references I think it's nice to point out the following: The above code works mostly. There are some colons missing at the end of the class, but those are easy to spot. If you replace the line if record.level != DEBUG: with if not record.levelno == DEBUG:, all non-DEBUG logs are filtered out nicely.
|
|
| Jun 14, 2013 at 13:45 | vote | accept | Marijke Luttekes | ||
| Jun 14, 2013 at 13:44 | comment | added | Marijke Luttekes | Thank you, I'll have to look what code works exactly, but with this information I'll get there. :) | |
| Jun 14, 2013 at 13:44 | comment | added | zmo | Here, I was just writing it out :-) | |
| Jun 14, 2013 at 13:40 | history | edited | zmo | CC BY-SA 3.0 |
added 660 characters in body
|
| Jun 14, 2013 at 13:30 | history | answered | zmo | CC BY-SA 3.0 |