Skip to content

Conversation

@rmjarvis
Copy link
Owner

Addressing another old issue here.

@parejkoj pointed out (#132) that our logging messages are a little overstated in terms of their level. Lots of purely informational messages use the WARNING level when there isn't anything unusual about them. This was mostly so there could be some fairly high level progress messages at the verbose=1 level, with more detailed info happening at the verbose=2 level.

This PR basically keeps that the same in terms of the verbose=1,2 split, but calls the more verbose level "VERBOSE" in the logging world, rather than INFO. Then the progress messages are moved from WARNING to INFO. Ones that really are warnings are kept as WARNING. I think this should make for more sensible logging messages for people who use a more marked up logging output than we do by default in Piff (i.e. LSSTDM).

Note: verbose=1 now shows both WARNING and INFO messages, which all used to be WARNING. If someone wants just WARNING, but not INFO, they can set verbose=0.5. The verbose=0 level is reserved for basically no output unless there is a real error.

@rmjarvis rmjarvis linked an issue Sep 15, 2025 that may be closed by this pull request
VERBOSE = (logging.INFO + logging.DEBUG) // 2
logging.addLevelName(VERBOSE, "VERBOSE")

class PiffLogger(logging.Logger):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that LSST's variant of this inherits from logging.LoggerAdapter instead, but I'm not familiar with the pros and cons, and since I see that you've looked at our code I'm guessing you've already weighed them.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try too hard, but LoggerAdapter doesn't have a addHandler method, which I use. Maybe there is a different syntax that would work for that. But just inheriting from Logger worked, so I went with that.

@rmjarvis rmjarvis merged commit 5fef72f into main Nov 7, 2025
9 checks passed
@rmjarvis rmjarvis deleted the logging branch November 7, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent piff log message levels

3 participants