* @see org.kapott.hbci.callback.HBCICallback#log(java.lang.String, int, java.util.Date, java.lang.StackTraceElement)
*/
public void log(String msg, int level, Date date, StackTraceElement trace)
{
BeanService service = Application.getBootLoader().getBootable(BeanService.class);
SynchronizeSession session = service.get(HBCISynchronizeBackend.class).getCurrentSession();
boolean log = true;
String type = null;
switch (level)
{
case HBCIUtils.LOG_INTERN:
case HBCIUtils.LOG_DEBUG2:
Logger.trace(msg);
log = false;
break;
case HBCIUtils.LOG_DEBUG:
Logger.debug(msg);
log = false;
break;
case HBCIUtils.LOG_INFO:
Logger.info(msg);
break;
case HBCIUtils.LOG_WARN:
// Die logge ich mit DEBUG - die nerven sonst
type = "warn";
if (msg != null && (msg.startsWith("konnte folgenden nutzerdefinierten Wert nicht in Nachricht einsetzen:") ||
msg.startsWith("could not insert the following user-defined data"))
)
{
Logger.debug(msg);
log = false;
break;
}
if (msg != null && msg.matches(".* Algorithmus .* nicht implementiert"))
{
Logger.debug(msg);
log = false;
break;
}
Logger.warn(msg);
break;
case HBCIUtils.LOG_ERR:
if (session != null && session.getStatus() == ProgressMonitor.STATUS_CANCEL)
{
log = false;
break;
}
else
{
type = "error";
Logger.error(msg + " " + trace.toString());
break;
}
default:
Logger.warn(msg);
}
if (log && session != null)
{
ProgressMonitor monitor = session.getProgressMonitor();
if (type != null)
monitor.log("[" + type + "] " + msg);
else
monitor.log(msg);
}