bash0 / cewe2pdf

A python script to turn cewe photobooks into pdfs
GNU General Public License v3.0
41 stars 26 forks source link

Adding logging message counts, first attempt #160

Closed AnEnglishmanInNorway closed 2 months ago

AnEnglishmanInNorway commented 2 months ago

Prints a summary count of all the logging messages in the two categories "config" and "root", like this

Total message counts, including messages suppressed by logger configuration
Config: WARNING[32], INFO[665]
Root:   ERROR[1], WARNING[4], INFO[38]

Should be good enough to fix #147, though I think it might still be a good idea to let clipart have its own logger

AnEnglishmanInNorway commented 2 months ago

I've been wondering about how these counts would be used. I suspect that each user will recognise, for his own cewe installation, the "normal" number of messages in each category, and will then check carefully if the number changes on any given run. In my case, for example, I know that there are a series of delivered xml files which always created an error message because of a missing space (before I fixed them🙂) So why don't we create a configuration option which allows each of us to specify how many messages of each kind are "acceptable", and then if those counts are exceeded the program can create a very visible final line: There are more messages than normal " The original issue is yours, @cweiske What do you think?

cweiske commented 2 months ago

At first it will be a summary of the problem areas the photo book has. Users do not have to scan all the log lines but get the grouped numbers and then can check the individual problems.

When tackling the problems, decreasing numbers will show that the problems have been solved bit by bit.

cweiske commented 2 months ago

I do not think that a "normal" number should be/needs to be configurable.

AnEnglishmanInNorway commented 2 months ago

I think that what is "normal" will vary within each franchise (what we call the key account) of the Cewe software, because the local customisation for each franchise will vary. A franchise in Scandinavia might add more snow backgrounds or cliparts, for example. I also think "normal" will vary from installation to installation, because each user will choose to download different cliparts in addition to the standard delivered set. And perhaps each user will have a personal style of album which causes the messages to vary. It's also possible that there might be differences in the messages which we log based on the platform type and configuration.

My idea was that, for any given user, a "clean" album ready for final conversion to pdf will still have a known set of logged messages about the cliparts, fonts, etc. That set of messages will probably be invariant across several "clean" albums, and can therefore be regarded as normal for that user's work. The user can then configure in the "normal" numbers of messages, and be reasonably sure that if he gets more than those normal numbers for a new album, then there are probably things which are strange for that particular album.

I'm probably going to put this "normal message count" capability in for my own use, it won't be much code. If the configuration section does not exist, then the message count summary will appear as implemented in commit https://github.com/bash0/cewe2pdf/pull/160/commits/1aa8fce3fdd3e83ab30dd7aa38f6a1a1789e35d7. I think that will be what you originally described.