|
|
|
|
|
The core has two main responsibilities:
The core consists of the following components:
The core API functions are primarily invoked by the application layer to implement its functionality, but some core elements may also be directly invoked by application code. For example, the core API function pantheios_isSeverityLogged() (or pantheios::isSeverityLogged() for C++ compilation units) may be used to determine whether to logging of a given severity level is enabled before doing any significant amount of log statement preparation.
if(pantheios::isSeverityLogged(pantheios::debug)) { std::string stringFormOfSomethingExpensive = . . . // pantheios::log_DEBUG("Something expensive: ", stringFormOfSomethingExpensive); }
Furthermore, Pantheios logging facilities are available from C client code via the core API directly, via the pantheios_printf() and pantheios_vprintf() functions:
int i; float f; pantheios_printf( PANTHEIOS_SEV_INFORMATIONAL, "int=%d, float=%g" , i, f);
However, it should be noted that the C functions in the core API do not offer either the type-safety or the genericity of the application layer, and so should be eschewed in C++ compilation code.
Modules | |
| Generated N-ary Core Functions | |
| Auto-generated functions that constitute the Type Tunnel, which acts as the bridge between the Pantheios Core API and the Pantheios Application Layer API. | |
Classes | |
| struct | pan_slice_t |
| String slice used by the Pantheios Application Layer API to communicate with the Pantheios Core API. More... | |
Enumerations | |
| enum | pan_severity_t { SEV_EMERGENCY = 0, SEV_ALERT = 1, SEV_CRITICAL = 2, SEV_ERROR = 3, SEV_WARNING = 4, SEV_NOTICE = 5, SEV_INFORMATIONAL = 6, SEV_DEBUG = 7 } |
| API Severity level. More... | |
Functions | |
| int | pantheios_init (void) |
| Initialises the pantheios library. | |
| void | pantheios_uninit (void) |
| Uninitialises the pantheios library. | |
| int | pantheios_isSeverityLogged (pan_sev_t severity) |
| Indicates whether a given severity is currently being logged by the process. | |
| char const * | pantheios_getSeverityString (pan_sev_t severity) |
| Returns a constant pointer to a non-NULL non-modifiable nul-terminated string representing the severity level. | |
| size_t | pantheios_getSeverityStringLength (pan_sev_t severity) |
| Returns the length of the string returned by pantheios_getSeverityString(). | |
| char const * | pantheios_getInitErrorString (int errCode) |
| Returns a constant pointer to a non-NULL non-modifiable nul-terminated string representing the initialisation error. | |
| size_t | pantheios_getInitErrorStringLength (int errCode) |
| Returns the length of the string returned by pantheios_getInitErrorString(). | |
| int | pantheios_log_n (pan_sev_t severity, size_t numSlices, pantheios::pan_slice_t const *slices) |
| Core logging function, which receives a severity and an array of string slices, and outputs them to the back-end. | |
| int | pantheios_logprintf (pan_sev_t severity, char const *format,...) |
| printf()-form of logging function, passing the formatted result to the back-end | |
| int | pantheios_logvprintf (pan_sev_t severity, char const *format, va_list args) |
| vprintf()-form of logging function, passing the formatted result to the back-end | |
| int | pantheios_getNextBackEndId (void) |
| Returns a (thread-safe) unique back-end identifier. | |
| void | pantheios_puts (pan_sev_t severity, char const *message) |
A functional equivalent to puts(), incorporating a severity level. | |
| int | isSeverityLogged (pan_sev_t severity) |
| Equivalent to pantheios_isSeverityLogged(). | |
| char const * | getSeverityString (pan_sev_t severity) |
| Equivalent to pantheios_getSeverityString(). | |
| size_t | getSeverityStringLength (pan_sev_t severity) |
| Equivalent to pantheios_getSeverityStringLength(). | |
| char const * | getInitErrorString (int errCode) |
| Equivalent to pantheios_getInitErrorString(). | |
| size_t | getInitErrorStringLength (int errCode) |
| Equivalent to pantheios_getInitErrorStringLength(). | |
| void | puts (pan_sev_t severity, char const *message) |
| Equivalent to pantheios_puts(). | |
| enum pan_severity_t |
API Severity level.
| char const* pantheios::getInitErrorString | ( | int | errCode | ) | [inline] |
Equivalent to pantheios_getInitErrorString().
| size_t pantheios::getInitErrorStringLength | ( | int | errCode | ) | [inline] |
Equivalent to pantheios_getInitErrorStringLength().
| char const* pantheios::getSeverityString | ( | pan_sev_t | severity | ) | [inline] |
Equivalent to pantheios_getSeverityString().
| size_t pantheios::getSeverityStringLength | ( | pan_sev_t | severity | ) | [inline] |
Equivalent to pantheios_getSeverityStringLength().
| int pantheios::isSeverityLogged | ( | pan_sev_t | severity | ) | [inline] |
Equivalent to pantheios_isSeverityLogged().
| char const* pantheios::pantheios_getInitErrorString | ( | int | errCode | ) |
Returns a constant pointer to a non-NULL non-modifiable nul-terminated string representing the initialisation error.
| errCode | The initialisation error code whose string explanation is to be returned. If the error code is not recognised, the empty string ("") will be returned. |
| size_t pantheios::pantheios_getInitErrorStringLength | ( | int | errCode | ) |
Returns the length of the string returned by pantheios_getInitErrorString().
| errCode | The initialisation error code whose string equivalent is to be returned. If the error code is not recognised, 0 will be returned. |
| int pantheios::pantheios_getNextBackEndId | ( | void | ) |
Returns a (thread-safe) unique back-end identifier.
This function provides back-end identiers, useful with custom use of Pantheios back-ends, that are guaranteed unique throughout a given process, even in the case where it is invoked by multiple threads concurrently.
| char const* pantheios::pantheios_getSeverityString | ( | pan_sev_t | severity | ) |
Returns a constant pointer to a non-NULL non-modifiable nul-terminated string representing the severity level.
| severity | The severity level whose string equivalent is to be returned. Must be one of the PANTHEIOS_SEV_* enumerators, otherwise, the empty string ("") will be returned. |
| size_t pantheios::pantheios_getSeverityStringLength | ( | pan_sev_t | severity | ) |
Returns the length of the string returned by pantheios_getSeverityString().
| severity | The severity level whose string equivalent is to be returned. Must be one of the PANTHEIOS_SEV_* enumerators, otherwise, 0 will be returned. |
| int pantheios::pantheios_init | ( | void | ) |
Initialises the pantheios library.
| <0 | initialisation has failed, and the library cannot be used | |
| >=0 | initialisation has succeeded, and the library can be used. pantheios_uninit() should be called when the library is no longer needed |
PANTHEIOS_NO_AUTO_INIT, which is automatically defined by a Windows DLL build (as detected by the presence of any of the __DLL__, _WINDLL, _USRDLL or _AFXDLL symbols). Auto-initialisation can be forced regardless of the definition of PANTHEIOS_NO_AUTO_INIT by the definition of the symbol PANTHEIOS_FORCE_AUTO_INIT. | int pantheios::pantheios_isSeverityLogged | ( | pan_sev_t | severity | ) |
Indicates whether a given severity is currently being logged by the process.
| severity | The severity level to test. Usually one of the PANTHEIOS_SEV_* enumerators. |
| 0 | The given severity level is not being logged. | |
| 1 | The given severity level is being logged. |
| int pantheios::pantheios_log_n | ( | pan_sev_t | severity, | |
| size_t | numSlices, | |||
| pantheios::pan_slice_t const * | slices | |||
| ) |
Core logging function, which receives a severity and an array of string slices, and outputs them to the back-end.
| severity | The severity of the log entry | |
| slices | Pointer to the array of slices | |
| numSlices | The number of slices |
| <0 | An error occurred | |
| >=0 | The log entry was successfully passed to the back-end |
| int pantheios::pantheios_logprintf | ( | pan_sev_t | severity, | |
| char const * | format, | |||
| ... | ||||
| ) |
printf()-form of logging function, passing the formatted result to the back-end
| severity | The severity of the log entry | |
| format | The format string |
| int pantheios::pantheios_logvprintf | ( | pan_sev_t | severity, | |
| char const * | format, | |||
| va_list | args | |||
| ) |
vprintf()-form of logging function, passing the formatted result to the back-end
| severity | The severity of the log entry | |
| format | The format string | |
| args | va_list form of the arguments |
| void pantheios::pantheios_puts | ( | pan_sev_t | severity, | |
| char const * | message | |||
| ) |
A functional equivalent to puts(), incorporating a severity level.
Using this function skips the application layer entirely, and goes straight to the core. It is therefore more suitable for use in emergency bail-out situations, such as in an application-level catch(...) clauses.
| severity | The severity of the message to be output. | |
| message | The message to be output. |
| void pantheios::pantheios_uninit | ( | void | ) |
Uninitialises the pantheios library.
Should be called for every call to pantheios_init() that returns a non-negative code
PANTHEIOS_NO_AUTO_INIT, which is automatically defined by a Windows DLL build (as detected by the presence of any of the __DLL__, _WINDLL, _USRDLL or _AFXDLL symbols). Auto-initialisation can be forced regardless of the definition of PANTHEIOS_NO_AUTO_INIT by the definition of the symbol PANTHEIOS_FORCE_AUTO_INIT. | void pantheios::puts | ( | pan_sev_t | severity, | |
| char const * | message | |||
| ) | [inline] |
Equivalent to pantheios_puts().
|
|
|
| pantheios Library documentation © Matthew Wilson, 2006-2008 |
|