Methods Summary |
---|
private int | LogTypePluginToCore(int pluginLogType)
switch (pluginLogType) {
case LT_INFORMATION:
return LogEvent.LT_INFORMATION;
case LT_WARNING:
return LogEvent.LT_WARNING;
case LT_ERROR:
return LogEvent.LT_ERROR;
}
return LogEvent.LT_INFORMATION;
|
public void | addListener(LoggerChannelListener l)
listeners.add( l );
|
protected java.lang.String | addTimeStamp(java.lang.String data)
if ( timestamp ){
return( getTimeStamp() + data );
}else{
return( data );
}
|
private static java.lang.String | format(int n)
if (n < 10){
return( "0" + n );
}
return( String.valueOf(n));
|
public org.gudy.azureus2.plugins.logging.Logger | getLogger()
return( logger );
|
public java.lang.String | getName()
return( name );
|
protected java.lang.String | getTimeStamp()
Calendar now = GregorianCalendar.getInstance();
String timeStamp =
"[" + now.get(Calendar.HOUR_OF_DAY)+ ":" + format(now.get(Calendar.MINUTE)) + ":" + format(now.get(Calendar.SECOND)) + "] ";
return( timeStamp );
|
public boolean | isEnabled()
return org.gudy.azureus2.core3.logging.Logger.isEnabled();
|
public void | log(java.lang.String data)
log( LT_INFORMATION, data );
|
public void | log(java.lang.Object[] relatedTo, int log_type, java.lang.String data)
notifyListeners(log_type, addTimeStamp(data));
if (isEnabled() && !no_output) {
data = "[" + name + "] " + data;
org.gudy.azureus2.core3.logging.Logger.log(new LogEvent(relatedTo, LOGID,
LogTypePluginToCore(log_type), data));
}
|
public void | log(java.lang.Object relatedTo, int log_type, java.lang.String data)
log(new Object[] { relatedTo }, log_type, data);
|
public void | log(java.lang.Throwable error)
log("", error);
|
public void | log(java.lang.String str, java.lang.Throwable error)
notifyListeners(str.equals("") ? "" : addTimeStamp(str), error);
if (!no_output) {
LogEvent event = new LogEvent(LOGID, "[" + name + "] " + str, error);
org.gudy.azureus2.core3.logging.Logger.log(event);
}
|
public void | log(java.lang.Object[] relatedTo, java.lang.String str, java.lang.Throwable error)
notifyListeners(str.equals("") ? "" : addTimeStamp(str), error);
if (isEnabled() && !no_output) {
str = "[" + name + "] " + str;
org.gudy.azureus2.core3.logging.Logger.log(new LogEvent(relatedTo, LOGID,
str, error));
}
|
public void | log(java.lang.Object relatedTo, java.lang.String str, java.lang.Throwable error)
log(new Object[] { relatedTo }, str, error);
|
public void | log(java.lang.Object[] relatedTo, java.lang.String data)
log(relatedTo, LT_INFORMATION, data);
|
public void | log(java.lang.Object relatedTo, java.lang.String data)
log(relatedTo, LT_INFORMATION, data);
|
public void | log(int log_type, java.lang.String data)
notifyListeners(log_type, addTimeStamp(data));
if (isEnabled() && !no_output) {
data = "[" + name + "] " + data;
org.gudy.azureus2.core3.logging.Logger.log(new LogEvent(LOGID,
LogTypePluginToCore(log_type), data));
}
|
protected void | logAlert(int alert_type, java.lang.String message, boolean repeatable)
// output as log message to any listeners
for (int i = 0; i < listeners.size(); i++) {
try {
((LoggerChannelListener) listeners.get(i)).messageLogged(alert_type,
addTimeStamp(message));
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
if (!no_output) {
int at;
switch (alert_type) {
case LoggerChannel.LT_INFORMATION: {
at = LogAlert.AT_INFORMATION;
break;
}
case LoggerChannel.LT_WARNING: {
at = LogAlert.AT_WARNING;
break;
}
default: {
at = LogAlert.AT_ERROR;
break;
}
}
org.gudy.azureus2.core3.logging.Logger.log(new LogAlert(repeatable, at,
message));
}
|
public void | logAlert(int alert_type, java.lang.String message)
logAlert( alert_type, message, false );
|
public void | logAlert(java.lang.String message, java.lang.Throwable e)
for (int i=0;i<listeners.size();i++){
try{
((LoggerChannelListener)listeners.get(i)).messageLogged( addTimeStamp( message ), e );
}catch( Throwable f ){
Debug.printStackTrace( f );
}
}
if ( !no_output ){
org.gudy.azureus2.core3.logging.Logger.log(new LogAlert(
LogAlert.UNREPEATABLE, message, e));
}
|
public void | logAlertRepeatable(int alert_type, java.lang.String message)
logAlert( alert_type, message, true );
|
public void | logAlertRepeatable(java.lang.String message, java.lang.Throwable e)
for (int i=0;i<listeners.size();i++){
try{
((LoggerChannelListener)listeners.get(i)).messageLogged( addTimeStamp( message ), e );
}catch( Throwable f ){
Debug.printStackTrace( f );
}
}
if ( !no_output ){
org.gudy.azureus2.core3.logging.Logger.log(new LogAlert(
LogAlert.REPEATABLE, message, e));
}
|
private void | notifyListeners(int log_type, java.lang.String data)
for (int i = 0; i < listeners.size(); i++) {
try {
LoggerChannelListener l = (LoggerChannelListener) listeners.get(i);
l.messageLogged(log_type, data);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
private void | notifyListeners(java.lang.String listenersText, java.lang.Throwable error)
for (int i = 0; i < listeners.size(); i++) {
try {
LoggerChannelListener l = (LoggerChannelListener) listeners.get(i);
l.messageLogged(listenersText, error);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public void | removeListener(LoggerChannelListener l)
listeners.remove(l);
|
public void | setDiagnostic()
if ( diagnostic_logger == null ){
diagnostic_logger = AEDiagnostics.getLogger( FileUtil.convertOSSpecificChars( name ));
addListener(
new LoggerChannelListener()
{
public void
messageLogged(
int type,
String content )
{
diagnostic_logger.log( content );
}
public void
messageLogged(
String str,
Throwable error )
{
diagnostic_logger.log( str );
diagnostic_logger.log( error );
}
});
}
|