Class LoggerChannelImpl
java.lang.Object
com.biglybt.pifimpl.local.logging.LoggerChannelImpl
- All Implemented Interfaces:
LoggerChannel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AEDiagnosticsLogger
(package private) final List
private final Logger
private static final LogIDs
private final String
(package private) final boolean
private final boolean
Fields inherited from interface com.biglybt.pif.logging.LoggerChannel
LT_ERROR, LT_INFORMATION, LT_WARNING
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LoggerChannelImpl
(Logger _logger, String _name, boolean _timestamp, boolean _no_output) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a LoggerChannelListener to this LoggerChannelprotected String
addTimeStamp
(String data) private static String
format
(int n) getCurrentFile
(boolean flush) retrieves the current file associated with the channel, null if noneboolean
getForce()
Retrieve the parent Logger object for this LoggerChannel.getName()
Returns the name of the Logger Channelprotected String
boolean
Indicates whether or not logging is enabled - use to optimise calls to the log methods that require resources to construct the message to be logged.void
Log a message of a specific type to this channel's loggervoid
Log a string against a list of objectsvoid
Log an error against a list of objects with implicit typeLoggerChannel.LT_INFORMATION
void
Log an error against a list of objectsvoid
Log an error against an object.void
Log an error against an object with implicit typeLoggerChannel.LT_INFORMATION
void
Log an error against an object.void
log text with implicit typeLoggerChannel.LT_INFORMATION
void
log an error with implicit type ofLoggerChannel.LT_ERROR
void
log an error with implicit type ofLoggerChannel.LT_ERROR
void
raise 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 void
void
Alert the user of an errorvoid
logAlertRepeatable
(int alert_type, String message) Raise an alert to the user, if UI present.void
logAlertRepeatable
(String message, Throwable e) Raise an alert to the user, if UI present.private int
LogTypePluginToCore
(int pluginLogType) private void
notifyListeners
(int log_type, String data) private void
notifyListeners
(String listenersText, Throwable error) void
Remove a reviously added LoggerChannelListenervoid
This causes the channel to also write to logs/name files in a cyclic fashion (c.f.void
setDiagnostic
(long max_file_size, boolean diag_timestamp) void
setForce
(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:LoggerChannel
Retrieve the parent Logger object for this LoggerChannel.- Specified by:
getLogger
in interfaceLoggerChannel
- Returns:
- Logger object
-
getName
Description copied from interface:LoggerChannel
Returns the name of the Logger Channel- Specified by:
getName
in interfaceLoggerChannel
- Returns:
- Logger channel name
-
isEnabled
public boolean isEnabled()Description copied from interface:LoggerChannel
Indicates 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:
isEnabled
in interfaceLoggerChannel
- Returns:
- Enabled state of logging
-
setDiagnostic
public void setDiagnostic()Description copied from interface:LoggerChannel
This causes the channel to also write to logs/name files in a cyclic fashion (c.f. the debug_1/2._log files)- Specified by:
setDiagnostic
in interfaceLoggerChannel
-
setForce
public void setForce(boolean forceToFile) Description copied from interface:LoggerChannel
logging to file is disabled by default in non-beta builds. This forces writing to file regardless- Specified by:
setForce
in interfaceLoggerChannel
-
getForce
public boolean getForce()- Specified by:
getForce
in interfaceLoggerChannel
- Returns:
-
getCurrentFile
Description copied from interface:LoggerChannel
retrieves the current file associated with the channel, null if none- Specified by:
getCurrentFile
in interfaceLoggerChannel
- Returns:
-
setDiagnostic
public void setDiagnostic(long max_file_size, boolean diag_timestamp) - Specified by:
setDiagnostic
in interfaceLoggerChannel
-
LogTypePluginToCore
private int LogTypePluginToCore(int pluginLogType) -
notifyListeners
-
notifyListeners
-
log
Description copied from interface:LoggerChannel
Log a message of a specific type to this channel's logger- Specified by:
log
in interfaceLoggerChannel
- Parameters:
log_type
- LT_* constantdata
- text to log
-
log
Description copied from interface:LoggerChannel
log text with implicit typeLoggerChannel.LT_INFORMATION
- Specified by:
log
in interfaceLoggerChannel
- Parameters:
data
- text to log
-
log
Description copied from interface:LoggerChannel
Log a string against a list of objects- Specified by:
log
in 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:LoggerChannel
Log an error against an object.- Specified by:
log
in 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:LoggerChannel
log an error with implicit type ofLoggerChannel.LT_ERROR
- Specified by:
log
in interfaceLoggerChannel
- Parameters:
error
- Throwable object to log
-
log
Description copied from interface:LoggerChannel
log an error with implicit type ofLoggerChannel.LT_ERROR
- Specified by:
log
in interfaceLoggerChannel
- Parameters:
str
- text to logerror
- Throwable object to log
-
log
Description copied from interface:LoggerChannel
Log an error against a list of objects- Specified by:
log
in 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:LoggerChannel
Log an error against an object.- Specified by:
log
in 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:LoggerChannel
Log an error against a list of objects with implicit typeLoggerChannel.LT_INFORMATION
- Specified by:
log
in 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:LoggerChannel
Log an error against an object with implicit typeLoggerChannel.LT_INFORMATION
- Specified by:
log
in 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:LoggerChannel
raise 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:
logAlert
in interfaceLoggerChannel
- Parameters:
alert_type
- LT_* constantmessage
- text to alert user with
-
logAlertRepeatable
Description copied from interface:LoggerChannel
Raise 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:
logAlertRepeatable
in interfaceLoggerChannel
- Parameters:
alert_type
- LT_* constantmessage
- text to alert user with
-
logAlert
Description copied from interface:LoggerChannel
Alert the user of an error- Specified by:
logAlert
in interfaceLoggerChannel
- Parameters:
message
- text to alert user withe
- Error that will be attached to the alert
-
logAlertRepeatable
Description copied from interface:LoggerChannel
Raise 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:
logAlertRepeatable
in interfaceLoggerChannel
- Parameters:
message
- text to alert user withe
- Error that will be attached to the alert
-
addListener
Description copied from interface:LoggerChannel
Add a LoggerChannelListener to this LoggerChannel- Specified by:
addListener
in interfaceLoggerChannel
- Parameters:
l
- Listener to add
-
removeListener
Description copied from interface:LoggerChannel
Remove a reviously added LoggerChannelListener- Specified by:
removeListener
in interfaceLoggerChannel
- Parameters:
l
- Listener to remove.
-
addTimeStamp
-
getTimeStamp
-
format
-