Seeing the history, the logging module doesn't encode/decode strings very well. So we have to encode/decode before the log behavior. Putting this in common place could make codes clean.
But I found __init__ is not the good choice. __str__/__unicode__ is better in this case, because:
LOG(err) calls err.__str__ and would fail in some character. So the duty to pass correct encoded or decoded string is the duty of __str__/__unicode__.
@Ian
Seeing the history, the logging module doesn't encode/decode strings very well. So we have to encode/decode before the log behavior. Putting this in common place could make codes clean.
But I found __init__ is not the good choice. __str__/__unicode__ is better in this case, because:
LOG(err) calls err.__str__ and would fail in some character. So the duty to pass correct encoded or decoded string is the duty of __str__ /__unicode_ _.