Class LoggerChannelImpl
java.lang.Object
com.biglybt.pifimpl.local.logging.LoggerChannelImpl
- All Implemented Interfaces:
LoggerChannel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AEDiagnosticsLogger(package private) final Listprivate final Loggerprivate static final LogIDsprivate final String(package private) final booleanprivate final booleanFields inherited from interface LoggerChannel
LT_ERROR, LT_INFORMATION, LT_WARNING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLoggerChannelImpl(Logger _logger, String _name, boolean _timestamp, boolean _no_output) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a LoggerChannelListener to this LoggerChannelprotected StringaddTimeStamp(String data) private static Stringformat(int n) getCurrentFile(boolean flush) retrieves the current file associated with the channel, null if nonebooleangetForce()Retrieve the parent Logger object for this LoggerChannel.getName()Returns the name of the Logger Channelprotected StringbooleanIndicates whether or not logging is enabled - use to optimise calls to the log methods that require resources to construct the message to be logged.voidLog a message of a specific type to this channel's loggervoidLog a string against a list of objectsvoidLog an error against a list of objects with implicit typeLoggerChannel.LT_INFORMATIONvoidLog an error against a list of objectsvoidLog an error against an object.voidLog an error against an object with implicit typeLoggerChannel.LT_INFORMATIONvoidLog an error against an object.voidlog text with implicit typeLoggerChannel.LT_INFORMATIONvoidlog an error with implicit type ofLoggerChannel.LT_ERRORvoidlog an error with implicit type ofLoggerChannel.LT_ERRORvoidraise an alert to the user, if UI present Note that messages shown to the user are filtered on unique message content So if you raise an identical alert the second + subsequent messages will not be shown.protected voidvoidAlert the user of an errorvoidlogAlertRepeatable(int alert_type, String message) Raise an alert to the user, if UI present.voidlogAlertRepeatable(String message, Throwable e) Raise an alert to the user, if UI present.private intLogTypePluginToCore(int pluginLogType) private voidnotifyListeners(int log_type, String data) private voidnotifyListeners(String listenersText, Throwable error) voidRemove a reviously added LoggerChannelListenervoidThis causes the channel to also write to logs/name files in a cyclic fashion (c.f.voidsetDiagnostic(long max_file_size, boolean diag_timestamp) voidsetForce(boolean forceToFile) logging to file is disabled by default in non-beta builds.
-
Field Details
-
LOGID
-
logger
-
name
-
timestamp
private final boolean timestamp -
no_output
final boolean no_output -
listeners
-
diagnostic_logger
-
-
Constructor Details
-
LoggerChannelImpl
-
-
Method Details
-
getLogger
Description copied from interface:LoggerChannelRetrieve the parent Logger object for this LoggerChannel.- Specified by:
getLoggerin interfaceLoggerChannel- Returns:
- Logger object
-
getName
Description copied from interface:LoggerChannelReturns the name of the Logger Channel- Specified by:
getNamein interfaceLoggerChannel- Returns:
- Logger channel name
-
isEnabled
public boolean isEnabled()Description copied from interface:LoggerChannelIndicates whether or not logging is enabled - use to optimise calls to the log methods that require resources to construct the message to be logged. Note that this doesn't apply to alerts - these will always be handled- Specified by:
isEnabledin interfaceLoggerChannel- Returns:
- Enabled state of logging
-
setDiagnostic
public void setDiagnostic()Description copied from interface:LoggerChannelThis causes the channel to also write to logs/name files in a cyclic fashion (c.f. the debug_1/2._log files)- Specified by:
setDiagnosticin interfaceLoggerChannel
-
setForce
public void setForce(boolean forceToFile) Description copied from interface:LoggerChannellogging to file is disabled by default in non-beta builds. This forces writing to file regardless- Specified by:
setForcein interfaceLoggerChannel- Parameters:
forceToFile-
-
getForce
public boolean getForce()- Specified by:
getForcein interfaceLoggerChannel- Returns:
-
getCurrentFile
Description copied from interface:LoggerChannelretrieves the current file associated with the channel, null if none- Specified by:
getCurrentFilein interfaceLoggerChannel- Returns:
-
setDiagnostic
public void setDiagnostic(long max_file_size, boolean diag_timestamp) - Specified by:
setDiagnosticin interfaceLoggerChannel
-
LogTypePluginToCore
private int LogTypePluginToCore(int pluginLogType) -
notifyListeners
-
notifyListeners
-
log
Description copied from interface:LoggerChannelLog a message of a specific type to this channel's logger- Specified by:
login interfaceLoggerChannel- Parameters:
log_type- LT_* constantdata- text to log
-
log
Description copied from interface:LoggerChannellog text with implicit typeLoggerChannel.LT_INFORMATION- Specified by:
login interfaceLoggerChannel- Parameters:
data- text to log
-
log
Description copied from interface:LoggerChannelLog a string against a list of objects- Specified by:
login interfaceLoggerChannel- Parameters:
relatedTo- a list of what this log is related to (ex. Peer, Torrent, Download, Object)log_type- LT_* constantdata- text to log
-
log
Description copied from interface:LoggerChannelLog an error against an object.- Specified by:
login interfaceLoggerChannel- Parameters:
relatedTo- What this log is related to (ex. Peer, Torrent, Download, Object, etc)log_type- LT_* constantdata- text to log
-
log
Description copied from interface:LoggerChannellog an error with implicit type ofLoggerChannel.LT_ERROR- Specified by:
login interfaceLoggerChannel- Parameters:
error- Throwable object to log
-
log
Description copied from interface:LoggerChannellog an error with implicit type ofLoggerChannel.LT_ERROR- Specified by:
login interfaceLoggerChannel- Parameters:
str- text to logerror- Throwable object to log
-
log
Description copied from interface:LoggerChannelLog an error against a list of objects- Specified by:
login interfaceLoggerChannel- Parameters:
relatedTo- a list of what this log is related to (ex. Peer, Torrent, Download, Object)str- text to logerror- Error that will be appended to the log entry
-
log
Description copied from interface:LoggerChannelLog an error against an object.- Specified by:
login interfaceLoggerChannel- Parameters:
relatedTo- What this log is related to (ex. Peer, Torrent, Download, Object, etc)str- text to logerror- Error that will be appended to the log entry
-
log
Description copied from interface:LoggerChannelLog an error against a list of objects with implicit typeLoggerChannel.LT_INFORMATION- Specified by:
login interfaceLoggerChannel- Parameters:
relatedTo- a list of what this log is related to (ex. Peer, Torrent, Download, Object)data- text to log
-
log
Description copied from interface:LoggerChannelLog an error against an object with implicit typeLoggerChannel.LT_INFORMATION- Specified by:
login interfaceLoggerChannel- Parameters:
relatedTo- What this log is related to (ex. Peer, Torrent, Download, Object, etc)data- text to log
-
logAlert
-
logAlert
Description copied from interface:LoggerChannelraise an alert to the user, if UI present Note that messages shown to the user are filtered on unique message content So if you raise an identical alert the second + subsequent messages will not be shown. Thus, if you want "identical" messages to be shown, prefix them with something unique like a timestamp.- Specified by:
logAlertin interfaceLoggerChannel- Parameters:
alert_type- LT_* constantmessage- text to alert user with
-
logAlertRepeatable
Description copied from interface:LoggerChannelRaise an alert to the user, if UI present. Subsequent, identical messages will always generate an alert (i.e. duplicates won't be filtered)- Specified by:
logAlertRepeatablein interfaceLoggerChannel- Parameters:
alert_type- LT_* constantmessage- text to alert user with
-
logAlert
Description copied from interface:LoggerChannelAlert the user of an error- Specified by:
logAlertin interfaceLoggerChannel- Parameters:
message- text to alert user withe- Error that will be attached to the alert
-
logAlertRepeatable
Description copied from interface:LoggerChannelRaise an alert to the user, if UI present. Subsequent, identical messages will always generate an alert (i.e. duplicates won't be filtered)- Specified by:
logAlertRepeatablein interfaceLoggerChannel- Parameters:
message- text to alert user withe- Error that will be attached to the alert
-
addListener
Description copied from interface:LoggerChannelAdd a LoggerChannelListener to this LoggerChannel- Specified by:
addListenerin interfaceLoggerChannel- Parameters:
l- Listener to add
-
removeListener
Description copied from interface:LoggerChannelRemove a reviously added LoggerChannelListener- Specified by:
removeListenerin interfaceLoggerChannel- Parameters:
l- Listener to remove.
-
addTimeStamp
-
getTimeStamp
-
format
-