public abstract class LogMessageBase extends java.lang.Object implements LogMessage
| Modifier and Type | Field and Description |
|---|---|
int |
nLogLevel
All reports with a level less than or equal this level will be reported.
|
static java.lang.String |
version
Version, history and license.
|
dateFormat, debug, error, fineDebug, fineInfo, info, minSecondsFormat, mNeverOutputToDisplay, mReportLevel, sVersion, warning| Constructor and Description |
|---|
LogMessageBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
flushReport()
Writes the content in the physical medium.
|
int |
getReportLevel()
access to the level of report.
|
int |
getReportLevelFromIdent(int ident)
gets the associated report level to a report identifier.
|
void |
report(java.lang.CharSequence sText,
java.lang.Throwable exception)
report of a excpetion (in a new line)
|
void |
report(int nLevel,
java.lang.CharSequence string)
report inside a line
|
void |
reportln(int nLevel,
java.lang.CharSequence string)
report begins at a new a line
|
void |
reportln(int nLevel,
int nLeftMargin,
java.lang.CharSequence string)
report begins at a new a line with left margin
|
int |
setReportLevel(int newLevel)
Set another level inside programming.
|
void |
setReportLevelToIdent(int ident,
int nLevelActive)
Sets a dedicated level number to the known output priorities.
|
void |
writeError(java.lang.CharSequence text)
Implemented only as wrapper around simple append output.
|
void |
writeError(java.lang.String msg,
java.lang.Object... args)
Implemented only as wrapper around simple append output.
|
void |
writeError(java.lang.String sError,
java.lang.Throwable exc)
Writes an error line caused by an exception.
|
void |
writeErrorAdd(java.lang.String msg,
java.lang.Object... args)
Writes an additional information for the error message after the already outputted error line in the same line.
|
void |
writef(java.lang.String msg,
java.lang.Object... args)
Implemented only as wrapper around simple append output.
|
void |
writeInfo(java.lang.CharSequence sInfo)
Appends an info to the end of the previous info, @see
LogMessage.writeInfoln(CharSequence). |
void |
writeInfo(java.lang.String msg,
java.lang.Object... args)
Implemented only as wrapper around simple append output.
|
void |
writeInfoAdd(java.lang.String msg,
java.lang.Object... args)
Writes an additional information for the info message after the already output info line in the same line.
|
void |
writeInfoln(java.lang.CharSequence sInfo)
Writes an information line to this or alternatively to System.out
|
void |
writeWarning(java.lang.CharSequence sError)
Writes an error line.
|
void |
writeWarning(java.lang.String msg,
java.lang.Object... args)
Implemented only as wrapper around simple append output.
|
void |
writeWarningAdd(java.lang.String msg,
java.lang.Object... args)
Writes an additional information for the warning message after the already outputt warning line in the same line.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, flush, isOnline, msgSec, sendMsg, sendMsgTime, sendMsgVaList, timeCurr, timeMsgpublic static final java.lang.String version
writef(String, Object...) Now calls String.format only
if at least one argument for it is given.
The problem was, that without arguments the string has contained '%' in the text, not considerate,
and the format has produced an error.
public int nLogLevel
public void writef(java.lang.String msg,
java.lang.Object... args)
String.format(String, Object...)
and then sends it via writeInfo(CharSequence).writef in interface LogMessagemsg - should begin with "\n", can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeInfo(java.lang.String msg,
java.lang.Object... args)
writeInfo in interface LogMessagemsg - should begin with "\n", can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeInfoAdd(java.lang.String msg,
java.lang.Object... args)
LogMessagewriteInfoAdd in interface LogMessagemsg - can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeWarning(java.lang.String msg,
java.lang.Object... args)
writeWarning in interface LogMessagemsg - can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeWarningAdd(java.lang.String msg,
java.lang.Object... args)
LogMessagewriteWarningAdd in interface LogMessagemsg - can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeError(java.lang.String msg,
java.lang.Object... args)
writeError in interface LogMessagemsg - can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeErrorAdd(java.lang.String msg,
java.lang.Object... args)
LogMessagewriteErrorAdd in interface LogMessagemsg - can be contain format placeholder, String.format(String, Object...) is usedargs - The args for the placeholder.public void writeError(java.lang.CharSequence text)
writeError in interface LogMessagetext - The error text, it should be without such hot spot words line "!!!ERROR!!!",
because the distinction in display should be done by the implementation of this method.
A good sample is writeErrorln("cannot create file: " + sFileName);public void writeInfoln(java.lang.CharSequence sInfo)
writeInfoln in interface LogMessagesInfo - String to be written.public void writeInfo(java.lang.CharSequence sInfo)
LogMessageLogMessage.writeInfoln(CharSequence).writeInfo in interface LogMessagesInfo - String to be written.public void writeWarning(java.lang.CharSequence sError)
LogMessagewriteWarning in interface LogMessagesError - The error text, it should be without such hot spot words line "!!!WARNING!!!",
because the distinction in display should be done by the implementation of this method.
A good sample is writeErrorln("file is empty: " + sFileName);public void writeError(java.lang.String sError,
java.lang.Throwable exc)
LogMessagewriteError in interface LogMessageexc - The catched Exception. The getMessage()-part of the exception is written after sError.
The stacktrace of the exception is written to report.public void report(int nLevel,
java.lang.CharSequence string)
LogMessagereport in interface LogMessagepublic void reportln(int nLevel,
int nLeftMargin,
java.lang.CharSequence string)
LogMessagereportln in interface LogMessagenLevel - write the report only if the demand level is greater or equal.nLeftMargin - determins a left margin. First a new line is outputted, followed by '*' and spaces.string - String to write.public void reportln(int nLevel,
java.lang.CharSequence string)
LogMessagereportln in interface LogMessagenLevel - write the report only if the demand level is greater or equal.string - String to write.public void report(java.lang.CharSequence sText,
java.lang.Throwable exception)
LogMessagereport in interface LogMessagepublic int setReportLevel(int newLevel)
setReportLevel in interface LogMessagenewLevel - The level to be set, use one of the defines MainCmdLogging_ifc.info to MainCmdLogging_ifc.fineDebugpublic int getReportLevel()
LogMessagegetReportLevel in interface LogMessagepublic void flushReport()
LogMessageflushReport in interface LogMessagepublic void setReportLevelToIdent(int ident,
int nLevelActive)
LogMessagesetReportLevelToIdent in interface LogMessagenLevelActive - Ones of the known priotity levels Report.error to Report.fineDebug.
class MyModule
{ /**Define module-specific numbers to identify a level.
* The numbers should be define regarding a band of numbers in the application.
* /
static final int myReportLevel1 = 3500, myReportLevel2=3501;
void init()
{ setLevelActive(myReportLevel1, Report.info); //This reports should be outputted always
setLevelActive(myReportLevel2, Report.debug); //This reports are debug infos.
}
void processAnything()
{ report.reportln( myReportLevel1, "InfoText"); //It depends on the report level settings
report.reportln( myReportLevel2, "DebugText");//whether it is outputed or not.
}
public int getReportLevelFromIdent(int ident)
LogMessagegetReportLevelFromIdent in interface LogMessageident - The identifier.