Package uk.ac.starlink.topcat
Class LogHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- uk.ac.starlink.topcat.LogHandler
-
public class LogHandler extends java.util.logging.Handler
Log handler which can provide a window displaying recent log events.- Since:
- 5 Aug 2021
- Author:
- Mark Taylor (Starlink)
-
-
Field Summary
Fields Modifier and Type Field Description static int
RING_SIZE
Maximum number of log records retained.
-
Constructor Summary
Constructors Modifier Constructor Description protected
LogHandler()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
static LogHandler
getInstance()
Returns the standard instance of this class.java.awt.Color
getRecordColor(java.util.logging.LogRecord record)
Maps log records to display colours.void
publish(java.util.logging.LogRecord record)
void
showWindow(java.awt.Component parent)
Displays a logging window which displays recent (the last 1000) and any future log messages.
-
-
-
Field Detail
-
RING_SIZE
public static final int RING_SIZE
Maximum number of log records retained.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LogHandler
protected LogHandler()
Constructor. Invoked lazily bygetInstance()
.
-
-
Method Detail
-
publish
public void publish(java.util.logging.LogRecord record)
- Specified by:
publish
in classjava.util.logging.Handler
-
flush
public void flush()
- Specified by:
flush
in classjava.util.logging.Handler
-
close
public void close()
- Specified by:
close
in classjava.util.logging.Handler
-
getRecordColor
public java.awt.Color getRecordColor(java.util.logging.LogRecord record)
Maps log records to display colours.- Parameters:
record
- log record- Returns:
- display colour
-
showWindow
public void showWindow(java.awt.Component parent)
Displays a logging window which displays recent (the last 1000) and any future log messages.- Parameters:
parent
- parent component, may be used for positioning
-
getInstance
public static LogHandler getInstance()
Returns the standard instance of this class.- Returns:
- singleton handler
-
-