'Log a message at severity level ERROR.
Log Exception \'exc\' to error log, possibly prepended by a preceding
error "msg", detailing at what point the error occurred.
In debug mode, we also output the full traceback that occurred
if one has been passed in via sys.info()[2].
Also save the Exception to a stack that can be output at the end
of the sync run when offlineiamp exits. It is recommended to
always pass in exceptions if possible, so we can give the user
the best debugging info.
We are always pushing tracebacks to the exception queue to
make them to be output at the end of the run to allow users
pass sensible diagnostics to the developers or to solve
problems by themselves.
One example of such a call might be:
ui.error(exc, sys.exc_info()[2], msg="While syncing Folder %s in "
"repo %s")'

def error(self, exc, exc_traceback=None, msg=None):

    if msg:
        self.logger.error(('ERROR:    %s\n        %s' % (msg, exc)))
    else:
        self.logger.error(('ERROR:    %s' % exc))
    instant_traceback = exc_traceback
    if (not self.debuglist):
        instant_traceback = None
    self.exc_queue.put((msg, exc, exc_traceback))
    if instant_traceback:
        self.logger.error(traceback.format_tb(instant_traceback))
