papis / papis-zotero

Zotero compatibility layer for papis
GNU General Public License v3.0
75 stars 17 forks source link

sql: Confusing error reporting #35

Open alexfikl opened 1 year ago

alexfikl commented 1 year ago

From #33

When not using the --log DEBUG option, if there is an error, you get, for each item, first a "negative" [ERROR] log entry than a "positive" [INFO] log entry.

This is also confusing. Makes mentally parsing the log difficult. At the beginning I wasnt even sure what > happened. I asked my self, what does this mean ? Did things went OK or not ? Was it a "sucess" or not ? Oh > ... , there is the word "ERROR" there, so things must have stopped, and nothing must have happened. But. It > did. Even with the error the items were "kind of imported".

This is confusing.

Were talking about importing data here. It doesnt matter what the end result is. Either succes or failure. Or something in between.

The important thing is that the end user should be 100% sure of what happened. Be 100% sure of what is the current state of the data is on the system.

Assuming he has backups. He should decide and the be able to rollback, delete everything, start over again.

I would expect something like this sequence of log entries

[INFO] Trying to export item XYZ (a nice  first neutral message)
[INFO] Sucessfully exported  item XYZ to folder foo/bar
[MAYBE] Some empty line here ? visually nice to separate
[INFO] Trying to export item ABC (a nice first neutral message)
[INFO] Sucessfully exported  item ABC to folder foo/bar

or in case something "bad" happens

[INFO] Trying to export item XYZ (a nice first neutral message)
[ERROR] Something bad happened .... bla bla bla ...
[INFO] Item XYZ exported to folder foo/bar with possible errors ... check blablabla ... some fields might be "wrong"
[MAYBE] Some empty line here ? visually nice to separate
[INFO] Trying to export item ABC (a nice first neutral message)
m040601 commented 1 year ago

Also good and commonly used in log "machinery" , is the word "WARNING"

So better than,

[INFO] Trying to export item XYZ (a nice first neutral message)
[ERROR] Something bad happened .... bla bla bla ...
[INFO] Item XYZ exported to folder foo/bar with possible errors ... check blablabla ... 

Would instead be,

[INFO] Trying to export item XYZ (a nice first neutral message)
[ERROR] Something bad happened .... bla bla bla ...
[WARNING] Item XYZ exported to folder foo/bar ... but ... missing this/that ...with possible errors ... check blablabla ... 

More of the top of my mind,

critical
error
warning
info
debug
vdebug (as is verbose or very detailed debug)