Package com.biglybt.pif.logging
Interface LoggerChannel
-
- All Known Implementing Classes:
LoggerChannelImpl
public interface LoggerChannel
Manipulation of a subsection (a channel) of the client's logging. A logger channel is created or retrieve viaLogger
. Typically, a plugin has it's own channel which it can manipulate. All channels are part of the client logging as a whole, meaning anything logged here will also be fed to any functionality that operates on logging data (with the exception ofLogger.getNullChannel(String)
).- Since:
- 2.0.7.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
LT_ERROR
Error Log Typestatic int
LT_INFORMATION
Information Log Typestatic int
LT_WARNING
Warning Log Type
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(LoggerChannelListener l)
Add a LoggerChannelListener to this LoggerChanneljava.io.File
getCurrentFile(boolean flush)
retrieves the current file associated with the channel, null if noneboolean
getForce()
Logger
getLogger()
Retrieve the parent Logger object for this LoggerChannel.java.lang.String
getName()
Returns the name of the Logger Channelboolean
isEnabled()
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(int log_type, java.lang.String data)
Log a message of a specific type to this channel's loggervoid
log(java.lang.Object[] relatedTo, int log_type, java.lang.String data)
Log a string against a list of objectsvoid
log(java.lang.Object[] relatedTo, java.lang.String data)
Log an error against a list of objects with implicit typeLT_INFORMATION
void
log(java.lang.Object[] relatedTo, java.lang.String data, java.lang.Throwable error)
Log an error against a list of objectsvoid
log(java.lang.Object relatedTo, int log_type, java.lang.String data)
Log an error against an object.void
log(java.lang.Object relatedTo, java.lang.String data)
Log an error against an object with implicit typeLT_INFORMATION
void
log(java.lang.Object relatedTo, java.lang.String data, java.lang.Throwable error)
Log an error against an object.void
log(java.lang.String data)
log text with implicit typeLT_INFORMATION
void
log(java.lang.String data, java.lang.Throwable error)
log an error with implicit type ofLT_ERROR
void
log(java.lang.Throwable error)
log an error with implicit type ofLT_ERROR
void
logAlert(int alert_type, java.lang.String message)
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.void
logAlert(java.lang.String message, java.lang.Throwable e)
Alert the user of an errorvoid
logAlertRepeatable(int alert_type, java.lang.String message)
Raise an alert to the user, if UI present.void
logAlertRepeatable(java.lang.String message, java.lang.Throwable e)
Raise an alert to the user, if UI present.void
removeListener(LoggerChannelListener l)
Remove a reviously added LoggerChannelListenervoid
setDiagnostic()
This causes the channel to also write to logs/name files in a cyclic fashion (c.f.void
setDiagnostic(long max_file_size, boolean timestamp)
void
setForce(boolean force_to_file)
logging to file is disabled by default in non-beta builds.
-
-
-
Field Detail
-
LT_INFORMATION
static final int LT_INFORMATION
Information Log Type- See Also:
- Constant Field Values
-
LT_WARNING
static final int LT_WARNING
Warning Log Type- See Also:
- Constant Field Values
-
LT_ERROR
static final int LT_ERROR
Error Log Type- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of the Logger Channel- Returns:
- Logger channel name
- Since:
- 2.0.7.0
-
isEnabled
boolean isEnabled()
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- Returns:
- Enabled state of logging
- Since:
- 2.3.0.2
-
setDiagnostic
void setDiagnostic()
This causes the channel to also write to logs/name files in a cyclic fashion (c.f. the debug_1/2._log files)- Since:
- 2.4.0.2
-
setDiagnostic
void setDiagnostic(long max_file_size, boolean timestamp)
-
setForce
void setForce(boolean force_to_file)
logging to file is disabled by default in non-beta builds. This forces writing to file regardless- Parameters:
force_to_file
-- Since:
- 4401
-
getForce
boolean getForce()
- Returns:
- Since:
- 4401
-
log
void log(int log_type, java.lang.String data)
Log a message of a specific type to this channel's logger- Parameters:
log_type
- LT_* constantdata
- text to log- Since:
- 2.0.7.0
-
log
void log(java.lang.String data)
log text with implicit typeLT_INFORMATION
- Parameters:
data
- text to log- Since:
- 2.1.0.0
-
log
void log(java.lang.Throwable error)
log an error with implicit type ofLT_ERROR
- Parameters:
error
- Throwable object to log- Since:
- 2.0.7.0
-
log
void log(java.lang.String data, java.lang.Throwable error)
log an error with implicit type ofLT_ERROR
- Parameters:
data
- text to logerror
- Throwable object to log- Since:
- 2.0.7.0
-
log
void log(java.lang.Object[] relatedTo, int log_type, java.lang.String data)
Log a string against a list of objects- Parameters:
relatedTo
- a list of what this log is related to (ex. Peer, Torrent, Download, Object)log_type
- LT_* constantdata
- text to log- Since:
- 2.3.0.7
-
log
void log(java.lang.Object relatedTo, int log_type, java.lang.String data)
Log an error against an object.- Parameters:
relatedTo
- What this log is related to (ex. Peer, Torrent, Download, Object, etc)log_type
- LT_* constantdata
- text to log- Since:
- 2.3.0.7
-
log
void log(java.lang.Object relatedTo, java.lang.String data, java.lang.Throwable error)
Log an error against an object.- Parameters:
relatedTo
- What this log is related to (ex. Peer, Torrent, Download, Object, etc)data
- text to logerror
- Error that will be appended to the log entry- Since:
- 2.3.0.7
-
log
void log(java.lang.Object[] relatedTo, java.lang.String data, java.lang.Throwable error)
Log an error against a list of objects- Parameters:
relatedTo
- a list of what this log is related to (ex. Peer, Torrent, Download, Object)data
- text to logerror
- Error that will be appended to the log entry- Since:
- 2.3.0.7
-
log
void log(java.lang.Object[] relatedTo, java.lang.String data)
Log an error against a list of objects with implicit typeLT_INFORMATION
- Parameters:
relatedTo
- a list of what this log is related to (ex. Peer, Torrent, Download, Object)data
- text to log- Since:
- 2.5.0.1
-
log
void log(java.lang.Object relatedTo, java.lang.String data)
Log an error against an object with implicit typeLT_INFORMATION
- Parameters:
relatedTo
- What this log is related to (ex. Peer, Torrent, Download, Object, etc)data
- text to log- Since:
- 2.5.0.1
-
logAlert
void logAlert(int alert_type, java.lang.String message)
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.- Parameters:
alert_type
- LT_* constantmessage
- text to alert user with- Since:
- 2.0.8.0
-
logAlert
void logAlert(java.lang.String message, java.lang.Throwable e)
Alert the user of an error- Parameters:
message
- text to alert user withe
- Error that will be attached to the alert- Since:
- 2.1.0.2
-
logAlertRepeatable
void logAlertRepeatable(int alert_type, java.lang.String message)
Raise an alert to the user, if UI present. Subsequent, identical messages will always generate an alert (i.e. duplicates won't be filtered)- Parameters:
alert_type
- LT_* constantmessage
- text to alert user with- Since:
- 2.1.0.2
-
logAlertRepeatable
void logAlertRepeatable(java.lang.String message, java.lang.Throwable e)
Raise an alert to the user, if UI present. Subsequent, identical messages will always generate an alert (i.e. duplicates won't be filtered)- Parameters:
message
- text to alert user withe
- Error that will be attached to the alert- Since:
- 2.1.0.2
-
addListener
void addListener(LoggerChannelListener l)
Add a LoggerChannelListener to this LoggerChannel- Parameters:
l
- Listener to add- Since:
- 2.0.8.0
-
removeListener
void removeListener(LoggerChannelListener l)
Remove a reviously added LoggerChannelListener- Parameters:
l
- Listener to remove.- Since:
- 2.0.8.0
-
getLogger
Logger getLogger()
Retrieve the parent Logger object for this LoggerChannel.- Returns:
- Logger object
- Since:
- 2.3.0.0
-
getCurrentFile
java.io.File getCurrentFile(boolean flush)
retrieves the current file associated with the channel, null if none- Returns:
-
-