Namespaces

Component blpapi_logging
[Package blpapi]

Provide a C call to register a call back for logging. More...

Namespaces

namespace  blpapi

Detailed Description

Provide a C call to register a call back for logging.

Outline
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);
     // ....
 }