BLPAPI C++ 3.26.5
Loading...
Searching...
No Matches
Component blpapi_logging

Namespaces

namespace  BloombergLP
namespace  BloombergLP::blpapi

Classes

struct  Logging

Detailed Description

Purpose:
Provide a C call to register a call back for logging
Description:
This component provides a C function that is used to register a callback for logging
Usage:
To use the call back a function needs to be created with the same definition of blpapi_Logging_Func_t. The callback will be called for all the log messages that have severity greater than or equal to the specified thresholdSeverity. A callback can be registered multiple number of times but only the last registered callback will be used. Registering with a NULL callback will de-register the callback.
extern "C" {
void myLoggerCallback(blpapi_UInt64_t threadId,
int severity,
blpapi_Datetime_t timestamp,
const char *category,
const char *message)
{
if (severity == blpapi_Logging_SEVERITY_FATAL) {
// Do some logic for abort here
}
std::cout << severity << "-->" << message << std::endl;
}
This callback needs to be registered with the library as
int main() {
// ....
blpapi_Logging_registerCallback(myLoggerCallback,
blpapi_Logging_SEVERITY_TRACE);
// ....
}