50 # define snprintf _snprintf 133 std::ostringstream n;
135 if(idx == std::string::npos) {
159 if(fmt[strlen(fmt) - 1] !=
'\n')
171 if(fmt[strlen(fmt) - 1] !=
'\n')
183 if(fmt[strlen(fmt) - 1] !=
'\n')
221 const char *fmtstr) {
224 "%s: file %s: line %d: %s",
char * getFormatString(const char *prefix, const char *file, int line, const char *fmtstr)
Creates the format string for formatting a message.
SystemConsoleHandler()
creates a SystemConsoleHandler instance
SystemConsoleHandler sysConHandler
The SystemConsoleHandler instance for common usage.
void SetUseExit(bool useExit=true)
Tells the handler, that exit/abort is to use instead of exceptions.
std::string traceFilename
file name for trace file (will be appended with file count!)
char formatStringBuffer[192]
Buffer for format strings to format a message.
bool traceEnabled
flag, true if trace is enabled
int traceFileCount
Counter for trace files.
void void void ATTRIBUTE_NORETURN void vffatal(const char *file, int line, const char *fmt,...) ATTRIBUTE_PRINTF(4
Format and send a error message to stderr and call exit or raise a exception.
void SetTraceFile(const char *name, unsigned int maxlines=0)
Sets the trace to file stream and enables tracing global.
void void void ATTRIBUTE_NORETURN void ATTRIBUTE_NORETURN void AbortApplication(int code)
Aborts application: uses abort or exception depending on useExitAndAbort.
Class, that handle messages to console and also exit/abort calls.
ATTRIBUTE_NORETURN void ExitApplication(int code)
Exits application: uses exit or exception depending on useExitAndAbort.
char messageStringBuffer[768]
Buffer for built message string itself, 4 times bigger than formatStringBuffer.
std::ostream * wrnStream
Stream, where warning and error messages are sent to.
void StopTrace(void)
Stops tracing global, close file, if set, redirect trace to nullStream.
std::ostream & traceOutStream(void)
Gives Access to trace stream.
unsigned int traceLines
how much lines are written on current trace file
std::ostream * msgStream
Stream, where normal messages are sent to.
void SetWarningStream(std::ostream *s)
Sets the output stream, where warnings and errors are sent to.
void trioaccess(const char *t, unsigned char val)
Helper function for writing trace (trace IO access)
bool traceToFile
flag, true if trace writes to filestream
void TraceNextLine(void)
Ends a trace line, performs reopen new filestream, if necessary.
void SetTraceStream(std::ostream *s)
Sets the trace to given stream and enables tracing global.
std::ostream * traceStream
Stream for trace output.
void void void vferror(const char *file, int line, const char *fmt,...) ATTRIBUTE_PRINTF(4
Format and send a error message to warning stream (default stderr)
int global_verbose_on
Verbose enable flag.
std::ostream * nullStream
/dev/null! ;-)
bool global_suppress_memory_warnings
flag to suppress invalid memory usage warnings
void vfmessage(const char *fmt,...) ATTRIBUTE_PRINTF(2
Format and send a message to message stream (default stdout)
void SetMessageStream(std::ostream *s)
Sets the output stream, where messages are sent to.
bool useExitAndAbort
Flag, if exit/abort have to be used instead of exceptions.
std::ofstream * fileTraceStream
open file stream for trace
unsigned int traceLinesOnFile
how much lines will be written on one trace file 0->means endless
void void vfwarning(const char *file, int line, const char *fmt,...) ATTRIBUTE_PRINTF(4
Format and send a warning message to warning stream (default stderr)