public class ReportWrapperLog extends java.lang.Object implements Report
Modifier and Type | Field and Description |
---|---|
(package private) LogMessage |
log |
anytime, debug, error, eventOrder, exitSuccessfull, exitUserAbort, exitWithArgumentError, exitWithErrors, exitWithFileProblems, exitWithNotes, exitWithWarnings, fineDebug, fineEventOrder, fineInfo, info, interested, mNeverOutputToDisplay, mReportLevel, version, warning
sVersion
Constructor and Description |
---|
ReportWrapperLog(LogMessage log) |
Modifier and Type | Method and Description |
---|---|
void |
close()
A call of this method closes the devices, which processed the message.
|
void |
flush()
A call of this method causes an activating of transmission of all messages since last flush.
|
void |
flushReport()
Writes the content in the physical medium.
|
int |
getExitErrorLevel()
get the errorLevel setted with setExitErrorLevel().
|
LogMessage |
getLogMessageErrorConsole()
Gets a LogMessage error output.
|
LogMessage |
getLogMessageOutputConsole()
Gets a LogMessage output.
|
LogMessage |
getLogMessageOutputFile()
Gets a LogMessage output.
|
int |
getReportLevel()
access to the level of report.
|
int |
getReportLevelFromIdent(int ident)
gets the associated report level to a report identifier.
|
boolean |
isOnline()
Checks whether the message output is available.
|
void |
openReportfile(java.lang.String sFileReport,
boolean bAppendReport) |
void |
report(int nLevel,
java.lang.String string)
report inside a line
|
void |
report(java.lang.String sText,
java.lang.Throwable exception)
report of a excpetion (in a new line)
|
void |
reportln(int nLevel,
int nLeftMargin,
java.lang.String string)
report begins at a new a line with left margin
|
void |
reportln(int nLevel,
java.lang.String string)
report begins at a new a line
|
boolean |
sendMsg(int identNumber,
java.lang.String text,
java.lang.Object... args)
Sends a message.
|
boolean |
sendMsgTime(int identNumber,
OS_TimeStamp creationTime,
java.lang.String text,
java.lang.Object... args)
Sends a message.
|
boolean |
sendMsgVaList(int identNumber,
OS_TimeStamp creationTime,
java.lang.String text,
Va_list args)
Sends a message.
|
void |
setExitErrorLevel(int level)
set the exitErrorLevel of the maximum of given level of every call.
|
void |
setOutputChannels(java.lang.Appendable outP,
java.lang.Appendable errP)
Sets destinations for output and error output.
|
void |
setReportLevelToIdent(int ident,
int nLevelActive)
Sets a dedicated level number to the known output priorities.
|
void |
writeError(java.lang.String sError)
Writes an error line.
|
void |
writeError(java.lang.String sError,
java.lang.Throwable exception)
Writes an error line caused by an exception.
|
void |
writeInfo(java.lang.String sInfo)
Appends an info to the end of the previous info, @see #writeInfoln.
|
void |
writeInfoln(java.lang.String sInfo)
Writes an info line.
|
void |
writeStackTrace(java.lang.Exception exc) |
void |
writeWarning(java.lang.String sError)
Writes an error line.
|
final LogMessage log
public ReportWrapperLog(LogMessage log)
public void flushReport()
MainCmdLogging_ifc
flushReport
in interface MainCmdLogging_ifc
public int getExitErrorLevel()
MainCmdLogging_ifc
getExitErrorLevel
in interface MainCmdLogging_ifc
public LogMessage getLogMessageOutputConsole()
Report
getLogMessageOutputConsole
in interface Report
public LogMessage getLogMessageErrorConsole()
Report
getLogMessageErrorConsole
in interface Report
public LogMessage getLogMessageOutputFile()
Report
getLogMessageOutputFile
in interface Report
public int getReportLevel()
MainCmdLogging_ifc
getReportLevel
in interface MainCmdLogging_ifc
public int getReportLevelFromIdent(int ident)
MainCmdLogging_ifc
getReportLevelFromIdent
in interface MainCmdLogging_ifc
ident
- The identifier.public void openReportfile(java.lang.String sFileReport, boolean bAppendReport) throws java.io.FileNotFoundException
openReportfile
in interface MainCmdLogging_ifc
java.io.FileNotFoundException
public void report(int nLevel, java.lang.String string)
MainCmdLogging_ifc
report
in interface MainCmdLogging_ifc
public void report(java.lang.String sText, java.lang.Throwable exception)
MainCmdLogging_ifc
report
in interface MainCmdLogging_ifc
public void reportln(int nLevel, int nLeftMargin, java.lang.String string)
MainCmdLogging_ifc
reportln
in interface MainCmdLogging_ifc
nLevel
- 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.String string)
MainCmdLogging_ifc
reportln
in interface MainCmdLogging_ifc
nLevel
- write the report only if the demand level is greater or equal.string
- String to write.public void setExitErrorLevel(int level)
MainCmdLogging_ifc
setExitErrorLevel
in interface MainCmdLogging_ifc
level
- Errorlevel how defined in Report, 0 is the lowest level (successfull), >0 is worse.public void setReportLevelToIdent(int ident, int nLevelActive)
MainCmdLogging_ifc
setReportLevelToIdent
in interface MainCmdLogging_ifc
nLevelActive
- 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 void writeError(java.lang.String sError)
MainCmdLogging_ifc
writeError
in interface MainCmdLogging_ifc
sError
- 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 writeError(java.lang.String sError, java.lang.Throwable exception)
MainCmdLogging_ifc
writeError
in interface MainCmdLogging_ifc
sError
- 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);exception
- The catched Exception. The getMessage()-part of the exception is written after sError.
The stacktrace of the exception is written to report.public void writeInfo(java.lang.String sInfo)
MainCmdLogging_ifc
writeInfo
in interface MainCmdLogging_ifc
sInfo
- String to be written.public void writeInfoln(java.lang.String sInfo)
MainCmdLogging_ifc
writeInfoln
in interface MainCmdLogging_ifc
sInfo
- String to be written.public void writeWarning(java.lang.String sError)
MainCmdLogging_ifc
writeWarning
in interface MainCmdLogging_ifc
sError
- 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 writeStackTrace(java.lang.Exception exc)
writeStackTrace
in interface MainCmdLogging_ifc
public void setOutputChannels(java.lang.Appendable outP, java.lang.Appendable errP)
MainCmdLogging_ifc
setOutputChannels
in interface MainCmdLogging_ifc
outP
- Destination for output. If null, current output isn't change.errP
- Destination for error output. If null, current output isn't change.public boolean sendMsg(int identNumber, java.lang.String text, java.lang.Object... args)
#sendMsg(int, OS_TimeStamp, String, Object...)
.sendMsg
in interface LogMessage
identNumber
- of the message. If it is negative, it is the same message as positive number,
but with information 'going state', where the positive number is 'coming state'.text
- The text representation of the message, format string, see java.lang.String.format(..).args
- 0, 1 or more arguments of any type.
The interpretation of the arguments is controlled by param text.public boolean sendMsgTime(int identNumber, OS_TimeStamp creationTime, java.lang.String text, java.lang.Object... args)
sendMsgTime
in interface LogMessage
identNumber
- of the message. If it is negative, it is the same message as positive number,
but with information 'going state', where the positive number is 'coming state'.creationTime
- absolute time stamp. @Java2C=perValue.text
- The text representation of the message, format string, see java.lang.String.format(..).args
- 0, 1 or more arguments of any type.
The interpretation of the arguments is controlled by param text.public boolean sendMsgVaList(int identNumber, OS_TimeStamp creationTime, java.lang.String text, Va_list args)
#sendMsg(int, OS_TimeStamp, String, Object...)
, but the parameter args is varied:sendMsgVaList
in interface LogMessage
identNumber
- creationTime
- text
- typeArgs
- Type chars, ZCBSIJFD for boolean, char, byte, short, int, long, float double.args
- Reference to a buffer which contains the values for a variable argument list.
vprintf(buffer, text, args)
.
The referenced instance shouldn't accepted as persistent outside processing time
of the called routine. Therefore stack content is able to provide.
public void close()
close
mean.
If the device is a log file writer it should be clearly.
close
may mean, the processing of messages is finite temporary.
An open
occurs automatically, if a new message is dispatched.close
in interface LogMessage
public void flush()
flush
mean.
If the device is a log file writer it should be clearly.
flush
may mean, the processing of messages is ready to transmit yet.flush
in interface LogMessage
public boolean isOnline()
isOnline
in interface LogMessage