Comment 1 for bug 1350735

Revision history for this message
RaiMan (raimund-hocke) wrote :

this is my idea about how to implement this:

you have some logger instance (e.g. myLogger), which in turn has some methods like .info, .error, .warning, ...., that accept a string as the one and only parameter.

now you can tell Debug to redirect to your logger using one of these methods:

Debug.setLoggerInfo(myLogger, "info");
Debug.setLoggerAction(myLogger, "whatever");
Debug.setLoggerError(myLogger, "whatever");
Debug.setLoggerDebug(myLogger, "whatever");

according to the message groups Settings.ActionLogs ( [log] ), Settings.InfoLogs( [info] ), Settings.DebugLogs ( [debug] )
additionally we have the error group ( [error] )

From now on messages created using Debug.info() would be redirected to myLogger.info(original_message) using reflection (the reason for the string parameter, to avoid the Java interface/callback implementation overhead).

question: should the prefix [.....] be contained in the message or would this be more flexible:
Debug.setLogger(myLogger)
Debug.setLoggerInfo("info", "new prefix");
Debug.setLoggerAction("whatever", "new prefix");
Debug.setLoggerError( "whatever", "new prefix");
Debug.setLoggerDebug("whatever", "new prefix");

additionally this could be convenient:
Debug.setLoggerAll(myLogger, "whatever", "new prefix");

which would return a message
[new prefix log/info/debug/error] message