TomWhitwell / SlowMovie

MIT License
342 stars 67 forks source link

Logging Level (-o) doesn't seem to work #60

Closed robweber closed 3 years ago

robweber commented 3 years ago

Describe the problem Running slowmovie.py with different log levels doesn't seem to produce any different results in the console log. By default it appears to be DEBUG level (says INFO in help menu) but trying to change it to other levels always has the same output.

Steps to Reproduce python slowmovie.py -o INFO

Watch the console output. Logging that should be debug is output. Linked to an example line.

Similarly using -o CRITICAL both debug and info lines are still output.

Platform Information N/A

qubist commented 3 years ago

I thought the log level flag only effected the info written to the logfile, and that the console always gets everything.

missionfloyd commented 3 years ago

That's exactly what it does. https://github.com/TomWhitwell/SlowMovie/blob/df9c4b1a45894c1a3d55c01df08f986ec71f9c71/slowmovie.py#L204 https://github.com/TomWhitwell/SlowMovie/blob/df9c4b1a45894c1a3d55c01df08f986ec71f9c71/slowmovie.py#L209 Would it be better to have another argument for the console level?

qubist commented 3 years ago

I feel like since most of the time the program won't be running from the console, it's fine to have all output go to the console in that case, and be able to chose what goes to the logs in all other cases. Maybe this isn't too clear in the documentation, though...

qubist commented 3 years ago

help="minimum importance-level of messages saved to the logfile (default: %(default)s)")

Maybe adding "(all messages go to the console)" or something like that here.

missionfloyd commented 3 years ago

The message does say "saved to the logfile". Seems okay to me, but maybe something like that could help.

qubist commented 3 years ago

Agreed. Let's see what rob thinks

robweber commented 3 years ago

Perhaps the wording is enough. Just anecdotally I don't think I've ever seen a program where setting the log level affects one part of the program but not another - or where DEBUG is the default. Certainly threw me off guard when I thought "I'll just turn the debug messages off" and couldn't.

qubist commented 3 years ago

Do you think making the console and log output always match up would be better?

qubist commented 3 years ago

I'd be willing to change it so that console output and logging always match up. That's certainly easier to understand from a user perspective. The only downside I see is if you want to look at the console for debug info for a bit, you'll add a bit of fluff to the log for however long you're looking at the console.

missionfloyd commented 3 years ago

That sounds fine, let's just do that. The levels could be added to the logfile so it can be grep'd.

Edit: done.

robweber commented 3 years ago

Commit: https://github.com/TomWhitwell/SlowMovie/commit/3c7d5c97b02ae2992e7a912252899e2ed09a2f21