public interface MainCmdLogging_ifc extends LogMessage
MainCmd
for command line programming
or org.vishia.gral.area9.GralArea9MainCmd
for the gral GUI.
MainCmdLoggingStream
. That class
adapts the standard System.out to this interface.
MainCmdLoggingStream
and MsgDispatchSystemOutErr
one can create messages which can be dispatched to any destinations.
Modifier and Type | Field and Description |
---|---|
static int |
anytime
Deprecated.
use instead Report.error or Report.errorDisplay
|
static int |
debug
report level to indicate the report should be written to detect problems in software.
|
static int |
error
report level to indicate the report should be written anytime and anyway.
|
static int |
eventOrder
Deprecated.
use instead Report.info or Report.infoDisplay
|
static int |
exitSuccessfull
exit value to indicate not at all problems.
|
static int |
exitUserAbort
exit value to indicate a unconditional abort of a process.
|
static int |
exitWithArgumentError
exit value to indicate a parameter error, that is a programmers error mostly.
|
static int |
exitWithErrors
exit value to indicate a error in the own process, at example due to failed data
|
static int |
exitWithFileProblems
exit value to indicate a file error, typicall write to a read only file, write to a failed directory, file not exists and others.
|
static int |
exitWithNotes
exit value to indicate the user should read something and medidate about.
|
static int |
exitWithWarnings
exit value to indicate some warnings, but no fatal errors.
|
static int |
fineDebug
report level to indicate all report should be written to detect problems in software with finely and heavyset reports.
|
static int |
fineEventOrder
Deprecated.
use instead Report.fineInfo or Report.infoDisplay
|
static int |
fineInfo
report level to indicate the report should be written if a user is interested on the order of the events finely.
|
static int |
info
report level to indicate the report should be written if a user is interested on notes of the progression of programm is working.
|
static int |
interested
Deprecated.
use instead Report.warning or Report.warningDisplay
|
static int |
mNeverOutputToDisplay
Mask bit to indicate, do not write to display.
|
static int |
mReportLevel
Mask for the in fact reportlevel, other bits may have another meaning.
|
static int |
version
Version and history:
2012-11-10 Hartmut chg: Name of this interface changed from Report to MainCmdLogging_ifc: The identifier Report
may be bad understanding, this interface is used as a logging interface.
|
static int |
warning
report level to indicate the report should be written if a user is interested on warnings.
|
sVersion
Modifier and Type | Method and Description |
---|---|
void |
flushReport()
Writes the content in the physical medium.
|
int |
getExitErrorLevel()
get the errorLevel setted with setExitErrorLevel().
|
int |
getReportLevel()
access to the level of report.
|
int |
getReportLevelFromIdent(int ident)
gets the associated report level to a report identifier.
|
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
|
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.
|
close, flush, isOnline, sendMsg, sendMsgTime, sendMsgVaList
static final int version
#getLogMessageErrorConsole()
setOutputChannels(Appendable, Appendable)
. All outputs are redirect-able now.
Used for output in a graphical text box.
static final int exitUserAbort
static final int exitWithArgumentError
static final int exitWithFileProblems
static final int exitWithErrors
static final int exitWithWarnings
static final int exitWithNotes
static final int exitSuccessfull
static final int error
static final int warning
static final int info
static final int fineInfo
static final int debug
static final int fineDebug
static final int mReportLevel
static final int mNeverOutputToDisplay
@Deprecated static final int anytime
@Deprecated static final int interested
@Deprecated static final int eventOrder
@Deprecated static final int fineEventOrder
void writeInfoln(java.lang.String sInfo)
sInfo
- String to be written.void writeInfo(java.lang.String sInfo)
sInfo
- String to be written.void writeWarning(java.lang.String sError)
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);void writeError(java.lang.String sError)
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);void writeError(java.lang.String sError, java.lang.Throwable exception)
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.void writeStackTrace(java.lang.Exception exc)
void openReportfile(java.lang.String sFileReport, boolean bAppendReport) throws java.io.FileNotFoundException
java.io.FileNotFoundException
void report(int nLevel, java.lang.String string)
void reportln(int nLevel, int nLeftMargin, java.lang.String string)
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.void reportln(int nLevel, java.lang.String string)
nLevel
- write the report only if the demand level is greater or equal.string
- String to write.void report(java.lang.String sText, java.lang.Throwable exception)
int getReportLevel()
void flushReport()
void setReportLevelToIdent(int ident, int nLevelActive)
nLevel
- The number identifying a dedicated level. This number should be greater than
the known priority levels, it means >= 10 or >=1000.
Use dedicated group of numbers for an application.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. }
int getReportLevelFromIdent(int ident)
ident
- The identifier.void setExitErrorLevel(int level)
level
- Errorlevel how defined in Report, 0 is the lowest level (successfull), >0 is worse.int getExitErrorLevel()
void setOutputChannels(java.lang.Appendable outP, java.lang.Appendable errP)
outP
- Destination for output. If null, current output isn't change.errP
- Destination for error output. If null, current output isn't change.