samples/cpp/windows/console/samples/diagnostics_logging_samples.cpp
void DiagnosticsLoggingEventLoggerWithoutFilter()
{
    std::mutex mtx;
    std::vector<std::string> messages;

    // Register a callback that will get invoked by Speech SDK on every new log message
    EventLogger::SetCallback([&messages, &mtx](std::string message) {
            // Copy the string and store it for further processing. Do not do any processing in the event thread!
            std::unique_lock<std::mutex> lock(mtx);
            messages.push_back(message);
        });

    // Do your Speech SDK calls... for example:
    auto config = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
    auto recognizer = SpeechRecognizer::FromConfig(config);

    // Stop logging by setting an empty callback
    EventLogger::SetCallback();

    // See resulting logs on the console
    std::cout << "Here are the logs we captured:\n";
    for (std::string message : messages)
    {
        std::cout << message;
    }
}
// Shows how to enabled Speech SDK trace logging events, while applying a filter. Microsoft may ask you to collect logs
// in order to investigate an issue you reported. The suggested filter will be provided by Microsoft.
Shows how to enabled Speech SDK trace logging events, while applying a filter. Microsoft may ask you to collect logs
in order to investigate an issue you reported. The suggested filter will be provided by Microsoft.
Shows how to enabled Speech SDK trace logging events while applying a filter . Microsoft may ask you to collect logs in order to investigate an issue you reported . The suggested filter will be provided by Microsoft .
void DiagnosticsLoggingEventLoggerWithoutFilter()
{
    std::mutex mtx;
    std::vector<std::string> messages;
    EventLogger::SetCallback([&messages, &mtx](std::string message) {
            std::unique_lock<std::mutex> lock(mtx);
            messages.push_back(message);
        });
    auto config = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
    auto recognizer = SpeechRecognizer::FromConfig(config);
    EventLogger::SetCallback();
    std::cout << "Here are the logs we captured:\n";
    for (std::string message : messages)
    {
        std::cout << message;
    }
}
void DiagnosticsLoggingEventLoggerWithoutFilter ( ) { std :: mutex mtx ; std :: vector < std :: string > messages ; EventLogger :: SetCallback ( [ & messages , & mtx ] ( std :: string message ) { std :: unique_lock < std :: mutex > lock ( mtx ) ; messages . push_back ( message ) ; } ) ; auto config = SpeechConfig :: FromSubscription ( " " , " " ) ; auto recognizer = SpeechRecognizer :: FromConfig ( config ) ; EventLogger :: SetCallback ( ) ; std :: cout << " \n " ; for ( std :: string message : messages ) { std :: cout << message ; } }
Shows how to enabled Speech SDK trace logging events, while applying a filter.
Shows how to enabled Speech SDK trace logging events while applying a filter .
// Register a callback that will get invoked by Speech SDK on every new log message // Copy the string and store it for further processing. Do not do any processing in the event thread! // Do your Speech SDK calls... for example: // Stop logging by setting an empty callback // See resulting logs on the console