johnrajbd / bots

Automatically exported from code.google.com/p/bots
0 stars 0 forks source link

Improve: (coding only) handling of exceptions and logging #229

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
For historical reasons bots handled the string formatting, parameters etc
different in logging than in errors.
This works the same now.
Usage: 
BotsError(u'tekst %(var1)s %(var2)s',{'var1':value1,'var2':value2})
botsglobal.logger.error(u'Error:\n%(txt)s',{'txt':txt})

This will break scripts where errors are raised.
This might looks trivial, but caused me a lot of troubles and errors.
Set up better tests for this.
Gives better translation strings (not fixed sequence of parameters).
Long code line are split up for better readability.
Cleaned up some inconsistent string/error formatting.

Original issue reported on code.google.com by hjebb...@gmail.com on 8 May 2013 at 1:49

GoogleCodeExporter commented 8 years ago
so it will not work any more like this?...
botsglobal.logger.info(u'here is some info: %s %s %s',info1,info2,info3)

I use logger.info or logger.debug extensively in my scripts, just checked and I 
have 150 instances to change.

Original comment by mjg1964 on 9 May 2013 at 8:39

GoogleCodeExporter commented 8 years ago
hi Mike,

good that you mention this.
no, that is not my intention.
Will check code, and use this explicitly in tests. This still should be OK.
What breaks is the raising of exceptions.

Original comment by hjebb...@gmail.com on 9 May 2013 at 12:41

GoogleCodeExporter commented 8 years ago

Original comment by hjebb...@gmail.com on 6 Sep 2013 at 4:54

GoogleCodeExporter commented 8 years ago

Original comment by hjebb...@gmail.com on 10 Sep 2013 at 12:46