|
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 diagnostic logging facilities are available from C client code via the core API directly, via the pantheios_logprintf() and pantheios_logvprintf() functions:
int i; float f; pantheios_logprintf(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 | |
pan_uint32_t | pantheios_getVersion (void) |
Returns information about the version of Pantheios. | |
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. | |
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, pan_char_t const *format,...) |
printf()-form of logging function, passing the formatted result to the back-end | |
int | pantheios_logvprintf (pan_sev_t severity, pan_char_t 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_logputs (pan_sev_t severity, pan_char_t const *message) |
A functional equivalent to puts() , incorporating a severity level. | |
void | pantheios_puts (pan_sev_t severity, pan_char_t const *message) |
[DEPRECATED] Equivalent to pantheios_logputs(). | |
int | isSeverityLogged (pan_sev_t severity) |
Equivalent to pantheios_isSeverityLogged(). | |
pan_char_t const * | getStockSeverityString (pan_sev_t severity) |
Equivalent to pantheios_getStockSeverityString(). | |
size_t | getStockSeverityStringLength (pan_sev_t severity) |
Equivalent to pantheios_getStockSeverityStringLength(). | |
char const * | getInitCodeString (int code) |
Equivalent to pantheios_getInitCodeString(). | |
size_t | getInitCodeStringLength (int code) |
Equivalent to pantheios_getInitCodeStringLength(). | |
void | logputs (pan_sev_t severity, pan_char_t const *message) |
Equivalent to pantheios_logputs(). | |
void | puts (pan_sev_t severity, pan_char_t const *message) |
[DEPRECATED] Equivalent to pantheios_logputs(). | |
int | logprintf (pan_sev_t severity, pan_char_t const *format,...) |
Equivalent to pantheios_logprintf(). | |
int | logvprintf (pan_sev_t severity, pan_char_t const *format, va_list args) |
Equivalent to pantheios_logvprintf(). |
enum pan_severity_t |
API Severity level.
char const* pantheios::getInitCodeString | ( | int | code | ) | [inline] |
Equivalent to pantheios_getInitCodeString().
size_t pantheios::getInitCodeStringLength | ( | int | code | ) | [inline] |
Equivalent to pantheios_getInitCodeStringLength().
pan_char_t const* pantheios::getStockSeverityString | ( | pan_sev_t | severity | ) | [inline] |
size_t pantheios::getStockSeverityStringLength | ( | pan_sev_t | severity | ) | [inline] |
Equivalent to pantheios_getStockSeverityStringLength().
int pantheios::isSeverityLogged | ( | pan_sev_t | severity | ) | [inline] |
Equivalent to pantheios_isSeverityLogged().
int pantheios::logprintf | ( | pan_sev_t | severity, | |
pan_char_t const * | format, | |||
... | ||||
) | [inline] |
Equivalent to pantheios_logprintf().
void pantheios::logputs | ( | pan_sev_t | severity, | |
pan_char_t const * | message | |||
) | [inline] |
Equivalent to pantheios_logputs().
int pantheios::logvprintf | ( | pan_sev_t | severity, | |
pan_char_t const * | format, | |||
va_list | args | |||
) | [inline] |
Equivalent to pantheios_logvprintf().
int pantheios::core::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.
pan_uint32_t pantheios::pantheios_getVersion | ( | void | ) |
Returns information about the version of Pantheios.
The value returned is split into 4 x 8 bits, as follows:
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
or _USRDLL
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::core::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, | |
pan_char_t 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 |
void pantheios::pantheios_logputs | ( | pan_sev_t | severity, | |
pan_char_t const * | message | |||
) |
A functional equivalent to puts()
, incorporating a severity level.
Using this function skips the application layer entirely and, if the given seveirty level is enabled, goes straight to the back-end. 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. |
int pantheios::pantheios_logvprintf | ( | pan_sev_t | severity, | |
pan_char_t 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, | |
pan_char_t const * | message | |||
) |
[DEPRECATED] Equivalent to pantheios_logputs().
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
or _USRDLL
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, | |
pan_char_t const * | message | |||
) | [inline] |
[DEPRECATED] Equivalent to pantheios_logputs().
|
|
pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 |