Package rma.swing.logging
Class DialogLogHandler
java.lang.Object
java.util.logging.Handler
rma.swing.logging.DialogLogHandler
A custom log handler that will display logged messages in a window
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDont use this, use getInstance() instead to get at the singleton. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIgnoredLoggerName
(String loggerNamePrefix) Adds a logger to the ignored list.void
addIgnoredSourceClass
(String stringPrefix) Adds a log record source class to the ignored list.void
Convenience method that will attach this log handler to the root logger.void
void
close()
part of the logger api, not implemented.void
Will close and dispose of the dialog.void
flush()
part of the logger api, not implemented.static DialogLogHandler
Access to the handler singleton instance.Returns a reference to the inteface that handles logged records, there is typically a UI piece behind the interface.Returns the level that controls whether the window is displayed.getTitle()
boolean
isFrame()
Is the window a frame or dialog?boolean
isModal()
If the window is a dialog, then it will be modal.void
Add a log record to this handler.void
Any logged errors greater than level will be logged, then the dialog will be pushed to the front to notify the uservoid
setFrame
(boolean isFrame) Determines if the window is a frame or dialog.void
void
setModal
(boolean isModal) If the window is a dialog, controls if it is modal.void
setParentWindow
(Window parentWindow) Sets the parent window for the log handler window.void
setShowDialogLevel
(Level level) Controls the level which will cause the window to display.void
Sets the title for the displayed window.void
Shows the windowvoid
showErrorLogWindow
(LogRecord logRecord) Adds the log record and shows the window.Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
Constructor Details
-
DialogLogHandler
public DialogLogHandler()Dont use this, use getInstance() instead to get at the singleton.
-
-
Method Details
-
setLogDisplayProvider
-
getInstance
Access to the handler singleton instance.- Returns:
-
attachToRootLogger
public void attachToRootLogger()Convenience method that will attach this log handler to the root logger. -
setParentWindow
Sets the parent window for the log handler window. Setting this value will have no effect until the current window is closed with disposeWindow(). A new window will subsequently be built as needed using this setting.- Parameters:
parentWindow
-
-
disposeWindow
public void disposeWindow()Will close and dispose of the dialog. A new one will be created if necessary. -
bringLogWindowToFront
public void bringLogWindowToFront() -
showErrorLogWindow
public void showErrorLogWindow()Shows the window -
showErrorLogWindow
Adds the log record and shows the window.- Parameters:
logRecord
-
-
setErrorLevelThatForcesDialogToFront
Any logged errors greater than level will be logged, then the dialog will be pushed to the front to notify the user- Parameters:
level
-
-
publish
Add a log record to this handler. -
getShowDialogLevel
Returns the level that controls whether the window is displayed.- Returns:
-
setShowDialogLevel
Controls the level which will cause the window to display. A log record with a level equal to or greater than the show dialog level will cause the window to be displayed when the record is logged.- Parameters:
level
-
-
addIgnoredLoggerName
Adds a logger to the ignored list.- Parameters:
loggerNamePrefix
-
-
addIgnoredSourceClass
Adds a log record source class to the ignored list.- Parameters:
stringPrefix
-
-
flush
public void flush()part of the logger api, not implemented. -
close
public void close()part of the logger api, not implemented. -
isModal
public boolean isModal()If the window is a dialog, then it will be modal.- Returns:
-
setModal
public void setModal(boolean isModal) If the window is a dialog, controls if it is modal. Changing this value has no effect on an already instantiated window. Call disposeWindow to force the current window to be closed and disposed of. A new window will be instantiated as needed using the new settings.- Parameters:
isModal
-
-
isFrame
public boolean isFrame()Is the window a frame or dialog?- Returns:
-
setFrame
public void setFrame(boolean isFrame) Determines if the window is a frame or dialog. Changing this value has no effect on an already instantiated window. Call disposeWindow to force the current window to be closed and disposed of. A new window will be instantiated as needed using the new settings.- Parameters:
isFrame
-
-
setTitle
Sets the title for the displayed window. Changing this value has no effect on an already instantiated window. Call disposeWindow to force the current window to be closed and disposed of. A new window will be instantiated as needed using the new settings.- Parameters:
title
-
-
getTitle
-
getLogRecordDisplay
Returns a reference to the inteface that handles logged records, there is typically a UI piece behind the interface.- Returns:
-