Search in sources :

Example 1 with LogRelation

use of com.biglybt.core.logging.LogRelation in project BiglyBT by BiglySoftware.

the class DownloadManagerMoveHandlerUtils method logError.

static void logError(String message, DownloadManager dm, Throwable e) {
    LogRelation lr = (dm instanceof LogRelation) ? (LogRelation) dm : null;
    if (lr == null) {
        return;
    }
    if (!Logger.isEnabled()) {
        return;
    }
    Logger.log(new LogEvent(lr, LogIDs.CORE, message, e));
}
Also used : LogRelation(com.biglybt.core.logging.LogRelation) LogEvent(com.biglybt.core.logging.LogEvent)

Example 2 with LogRelation

use of com.biglybt.core.logging.LogRelation in project BiglyBT by BiglySoftware.

the class LoggerChannelImpl method log.

@Override
public void log(Object[] relatedTo, int log_type, String data) {
    String listenerData;
    if (relatedTo != null) {
        StringBuilder text = new StringBuilder();
        for (int i = 0; i < relatedTo.length; i++) {
            Object obj = relatedTo[i];
            if (obj == null)
                continue;
            if (i > 0)
                text.append("; ");
            if (obj instanceof LogRelation) {
                text.append(((LogRelation) obj).getRelationText());
            } else {
                text.append("RelatedTo[").append(obj.toString()).append("]");
            }
        }
        listenerData = text.toString() + "] " + data;
    } else {
        listenerData = data;
    }
    notifyListeners(log_type, addTimeStamp(listenerData));
    if (isEnabled() && !no_output) {
        data = "[" + name + "] " + data;
        com.biglybt.core.logging.Logger.log(new LogEvent(relatedTo, LOGID, LogTypePluginToCore(log_type), data));
    }
}
Also used : LogRelation(com.biglybt.core.logging.LogRelation) LogEvent(com.biglybt.core.logging.LogEvent)

Example 3 with LogRelation

use of com.biglybt.core.logging.LogRelation in project BiglyBT by BiglySoftware.

the class DownloadManagerMoveHandlerUtils method logWarn.

static void logWarn(String message, DownloadManager dm) {
    LogRelation lr = (dm instanceof LogRelation) ? (LogRelation) dm : null;
    if (lr == null) {
        return;
    }
    if (!Logger.isEnabled()) {
        return;
    }
    Logger.log(new LogEvent(lr, LogIDs.CORE, LogEvent.LT_WARNING, message));
}
Also used : LogRelation(com.biglybt.core.logging.LogRelation) LogEvent(com.biglybt.core.logging.LogEvent)

Example 4 with LogRelation

use of com.biglybt.core.logging.LogRelation in project BiglyBT by BiglySoftware.

the class DownloadManagerMoveHandlerUtils method logInfo.

// Helper log functions.
static void logInfo(String message, DownloadManager dm) {
    LogRelation lr = (dm instanceof LogRelation) ? (LogRelation) dm : null;
    if (lr == null) {
        return;
    }
    if (!Logger.isEnabled()) {
        return;
    }
    Logger.log(new LogEvent(lr, LogIDs.CORE, LogEvent.LT_INFORMATION, message));
}
Also used : LogRelation(com.biglybt.core.logging.LogRelation) LogEvent(com.biglybt.core.logging.LogEvent)

Aggregations

LogEvent (com.biglybt.core.logging.LogEvent)4 LogRelation (com.biglybt.core.logging.LogRelation)4