TEMU
2
The Terma Emulator
|
Go to the source code of this file.
Macros | |
#define | temu_logDebug temu_logDebugFunc |
#define | teLC_FirstUserCat 8 |
#define | teLC_DefaultCat 0 |
#define | teLC_SimCat 1 |
#define | teLC_TargetCat 2 |
#define | teLC_ConfigCat 3 |
Typedefs | |
typedef enum temu_LogLevel | temu_LogLevel |
Enumerations | |
enum | temu_LogLevel { teLL_Fatal = 0, teLL_Critical = 0, teLL_Error, teLL_Warning, teLL_Info, teLL_Debug } |
Functions | |
TEMU_API void | temu_logSetLevel (temu_LogLevel LogLevel) |
TEMU_API void | temu_logSetFunc (void(*LogFunc)(const char *)) |
TEMU_API void | temu_logSetDefaultFile (FILE *FP) |
TEMU_API void | temu_logSetColour (int Enable) |
TEMU_API void | temu_logFatal (const void *Obj, const char *Msg,...) __attribute__((format(printf |
temu_logFatal Log a message with fatal severity; The program will terminate after calling this More... | |
TEMU_API void TEMU_API void | temu_logCritical (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void | __attribute__ ((deprecated)) |
TEMU_API void | temu_logError (const void *Obj, const char *Msg,...) __attribute__((format(printf |
temu_logError Log a message with error severity More... | |
TEMU_API void TEMU_API void | temu_logWarning (const void *Obj, const char *Msg,...) __attribute__((format(printf |
temu_logWarning Log a message with warning severity More... | |
TEMU_API void TEMU_API void TEMU_API void | temu_logInfo (const void *Obj, const char *Msg,...) __attribute__((format(printf |
temu_logInfo Log a message with info severity More... | |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logDebugFunc (const void *Obj, const char *Msg,...) __attribute__((format(printf |
temu_logDebugFunc Log a message with debug severity More... | |
TEMU_API void | temu_logToCategoryVA (const void *Obj, unsigned Category, temu_LogLevel Severity, const char *Msg, va_list Args) |
TEMU_API void | temu_logToCategory (const void *Obj, unsigned Category, temu_LogLevel Severity, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void | temu_logSimFatal (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void | temu_logSimError (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logSimWarning (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logSimInfo (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logTargetFatal (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logTargetError (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logTargetWarning (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logTargetInfo (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logConfigFatal (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logConfigError (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logConfigWarning (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void | temu_logConfigInfo (const void *Obj, const char *Msg,...) __attribute__((format(printf |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API temu_LogLevel | temu_objectGetLogLevel (void *Obj, unsigned Category) |
TEMU_API void | temu_objectSetLogLevel (void *Obj, unsigned Category, temu_LogLevel LogLevel) |
T-EMU logging functions. T-EMU provides a logging facility to log messages from models. These messages can be of a number of severity levels and will be assigned to a model object. When printing the message will be formatted as follows: "<severity> : <object> : message\n", where <severity> is one of debug, info, warning, error and critical and <object> is the name of the object generating the log message.
T-EMU provides a "critical" log message, these messages are critical in the sense that after they have been logged, the emulator will terminate abnormally. Critical messages should never happen normally are typically placed in unreachable code locations.
Error messages imply that something failed but that the caller of the failed function is expected to take action in some way. Typical case is when opening a file (e.g. an SREC or ELF binary) specified by the user and the file did not exist.
Warning message exist to notify the user about something that may be an issue, but not necessarily is. An example is in the object system temu_checkSanity function, which will check whether objects are properly configured by being fully connected.
Info messages are normal messages, that exist solely to provide information to the user. For example, a model may print status info after it has been created.
Debug messages should not occur during normal use, and the debug function will be a static inline function with no body when building a model with -DNDEBUG. This is important, because the compiler will eliminate the call to the empty function, while still remaining fully typesafe and NOT being a macro.
Definition in file Logging.h.
#define temu_logDebug temu_logDebugFunc |
typedef enum temu_LogLevel temu_LogLevel |
Logging levels corresponds roughly to some of the RFC 5424 severity levels.
enum temu_LogLevel |
Logging levels corresponds roughly to some of the RFC 5424 severity levels.
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logConfigError | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log configuration error
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logConfigFatal | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log configuration fatal error
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logConfigInfo | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log configuration info
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logConfigWarning | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log configuration warning
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logDebugFunc | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
temu_logDebugFunc Log a message with debug severity
Obj | is the source of the log message |
Msg | The message to log |
TEMU_API void temu_logError | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
temu_logError Log a message with error severity
Obj | is the source of the log message |
Msg | The message to log |
TEMU_API void temu_logFatal | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
temu_logFatal Log a message with fatal severity; The program will terminate after calling this
Obj | is the source of the log message |
Msg | The message to log |
temu_logInfo Log a message with info severity
Obj | is the source of the log message |
Msg | The message to log |
TEMU_API void temu_logSetColour | ( | int | Enable | ) |
Enable colours on logging
Enable | 0 to disable colours, 1 to enable |
TEMU_API void temu_logSetDefaultFile | ( | FILE * | FP | ) |
Set the logging file for the default logging function. Pass NULL to restore default (stderr).
FP | Logging file pointer, NULL to restore default. |
TEMU_API void temu_logSetFunc | ( | void(*)(const char *) | LogFunc | ) |
Set logging function.
It is possible to provide a custom function for handling logging messages from T-EMU. This can be used by a simulator that provides a centralised logging facility to also handle T-EMU logging messages. By default, the messages will be printed to stderr using fputs. Note that messages will be terminated by "\n\0", so if your logging system adds a linefeed, the message may need to be transformed.
LogFunc | Logging function to use. NULL to restore the default. |
TEMU_API void temu_logSetLevel | ( | temu_LogLevel | LogLevel | ) |
Set logging level. Messages will be logged if they are of the set level or higher priority.
LogLevel | The logging level. |
TEMU_API void TEMU_API void TEMU_API void temu_logSimError | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log simulation error
Obj | Object Msg Printf formatted message string |
Log fatal issue Fatal messages result in termination of the program after the message.
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logSimInfo | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log simulation info
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logSimWarning | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log simulation warning
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logTargetError | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log target error
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logTargetFatal | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log target fatal error This should typically never happen, but it may be convenient in some cases.
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logTargetInfo | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log target info
Obj | Object Msg Printf formatted message string |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void temu_logTargetWarning | ( | const void * | Obj, |
const char * | Msg, | ||
... | |||
) |
Log target warning
Obj | Object Msg Printf formatted message string |
TEMU_API void temu_logToCategory | ( | const void * | Obj, |
unsigned | Category, | ||
temu_LogLevel | Severity, | ||
const char * | Msg, | ||
... | |||
) |
Log message in the numbered category
TEMU_API void temu_logToCategoryVA | ( | const void * | Obj, |
unsigned | Category, | ||
temu_LogLevel | Severity, | ||
const char * | Msg, | ||
va_list | Args | ||
) |
temu_logWarning Log a message with warning severity
Obj | is the source of the log message |
Msg | The message to log |
TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API void TEMU_API temu_LogLevel temu_objectGetLogLevel | ( | void * | Obj, |
unsigned | Category | ||
) |
TEMU_API void temu_objectSetLogLevel | ( | void * | Obj, |
unsigned | Category, | ||
temu_LogLevel | LogLevel | ||
) |