public class GLogger extends Object
GEnvironment
. If the log file is not initialized, all items send to the log file are ignored. The
log file is closed automatically during the application shutting down without action of the application
maker. The class allows events recording by methods writeLogInfo(Type, String, String, boolean)
,
writeLogWarn(Type, String, String, boolean)
,and
writeLogError(Type, String, String, boolean)
, depending on its criticity. Events of the log file
are composed of following fields:
Modifier and Type | Class and Description |
---|---|
static class |
GLogger.Criticity
Critcity of the event.
|
static class |
GLogger.Type
Log event type.
|
Constructor and Description |
---|
GLogger(String logFilename,
boolean createViewer)
GLog contructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the log file before the object is destroyed.
|
GLogEventTablePanel |
getGLogViewer()
Get the log viewer.
|
static void |
setErrorColor(Color errorColor)
Setter of the ERROR color.
|
static void |
setInfoColor(Color infoColor)
Setter of the INFO color.
|
static void |
setWarningColor(Color warningColor)
Setter of the WARNING color.
|
void |
writeLogError(GLogger.Type type,
String source,
String description)
Write a log entry with ERROR criticity.
|
void |
writeLogError(GLogger.Type type,
String source,
String description,
boolean sendToStderr)
Write a log entry with ERROR criticity.
|
void |
writeLogInfo(GLogger.Type type,
String source,
String description)
Write a log entry with INFO criticity.
|
void |
writeLogInfo(GLogger.Type type,
String source,
String description,
boolean sendToStderr)
Write a log entry with INFO criticity.
|
void |
writeLogUser(GLogger.Criticity criticity,
String source,
String description)
Write a log entry with USER type.
|
void |
writeLogUser(GLogger.Criticity criticity,
String source,
String description,
boolean sendToStderr)
Write a log entry with USER type.
|
void |
writeLogWarn(GLogger.Type type,
String source,
String description)
Write a log entry with WARN criticity.
|
void |
writeLogWarn(GLogger.Type type,
String source,
String description,
boolean sendToStderr)
Write a log entry with WARN criticity.
|
public GLogger(String logFilename, boolean createViewer) throws IOException
logFilename
- filename of the log to create.createViewer
- create the logTable Viewer.IOException
- in case of error creating the log file.public GLogEventTablePanel getGLogViewer()
public static void setErrorColor(Color errorColor)
errorColor
- to be set.public static void setInfoColor(Color infoColor)
color
- to be set.public static void setWarningColor(Color warningColor)
color
- to be set.public void close()
public void writeLogInfo(GLogger.Type type, String source, String description, boolean sendToStderr)
type
- of the log entry.source
- or the log entry.description
- of the log entry.sendToStderr
- if true the log message is also send to the stderr.public void writeLogInfo(GLogger.Type type, String source, String description)
type
- of the log entry.source
- or the log entry.description
- of the log entry.public void writeLogWarn(GLogger.Type type, String source, String description, boolean sendToStderr)
type
- of the log entry.source
- or the log entry.description
- of the log entry.sendToStderr
- if true the log message is also send to the stderr.public void writeLogWarn(GLogger.Type type, String source, String description)
type
- of the log entry.source
- or the log entry.description
- of the log entry.public void writeLogError(GLogger.Type type, String source, String description, boolean sendToStderr)
type
- of the log entry.source
- or the log entry.description
- of the log entry.sendToStderr
- if true the log message is also send to the stderr.public void writeLogError(GLogger.Type type, String source, String description)
type
- of the log entry.source
- or the log entry.description
- of the log entry.public void writeLogUser(GLogger.Criticity criticity, String source, String description, boolean sendToStderr)
criticity
- of the log entry.source
- or the log entry.description
- of the log entry.sendToStderr
- if true the log message is also send to the stderr.public void writeLogUser(GLogger.Criticity criticity, String source, String description)
criticity
- of the log entry.source
- or the log entry.description
- of the log entry.Copyright © 2024. All rights reserved.