samples/cpp/windows/console/samples/diagnostics_logging_samples.cpp
void DiagnosticsLoggingMemoryLogger()
{
    // Optional - Apply a filter, such that only traces that contain either one of the
    // filter strings will be logged
    /*
    std::initializer_list<std::string> filters = { "YourFirstString", "YourSecondString" };
    MemoryLogger::SetFilters(filters);
    */

    // Turn on logging to memory
    MemoryLogger::Start();

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

    // Define the full path and name of a log file on your local disk
    std::string logFile = "speech-sdk-log.txt";

    // At any time (while still logging or after logging is stopped) you can dump the traces
    // in memory to a file:
    MemoryLogger::Dump(logFile);

    // Or to any stream object that is derived from std::ostream. For example, std::cout.
    // Using std::cout will enable logging to the standard output stream (your console Windows):
    MemoryLogger::Dump(std::cout);

    // Or to a vector of strings, and see the results on the console:
    std::vector<std::string> messages = MemoryLogger::Dump();

    std::cout << "Here are the logs we captured:\n";
    for (std::string message : messages)
    {
        std::cout << message;
    }

    // Stop logging to memory
    MemoryLogger::Stop();

    // Clear filters if previously set
    MemoryLogger::SetFilters();
}
// Shows how to enable Speech SDK trace logging to memory. Memory logger keeps logging into a fixed-size
// memory buffer (a "ring" buffer). At any pointer in time, when an issue occurs, the application
// can dump the whole content of the memory buffer in one of several formats. For example, an
// application using Speech SDK for speech recognition, may want to dump the content of the
// logging memory buffer to file for one or more unexpected CancellationErrorCode values received
// (instead of a recognition result).
// Microsoft may ask you to collect logs using MemoryLogger in order to investigate an issue you reported,
// and will guide you on when to do the dump.
Shows how to enable Speech SDK trace logging to memory. Memory logger keeps logging into a fixed-size
memory buffer (a "ring" buffer). At any pointer in time, when an issue occurs, the application
can dump the whole content of the memory buffer in one of several formats. For example, an
application using Speech SDK for speech recognition, may want to dump the content of the
logging memory buffer to file for one or more unexpected CancellationErrorCode values received
(instead of a recognition result).
Microsoft may ask you to collect logs using MemoryLogger in order to investigate an issue you reported,
and will guide you on when to do the dump.
Shows how to enable Speech SDK trace logging to memory . Memory logger keeps logging into a fixed - size memory buffer ( a " ring " buffer ) . At any pointer in time when an issue occurs the application can dump the whole content of the memory buffer in one of several formats . For example an application using Speech SDK for speech recognition may want to dump the content of the logging memory buffer to file for one or more unexpected CancellationErrorCode values received ( instead of a recognition result ) . Microsoft may ask you to collect logs using MemoryLogger in order to investigate an issue you reported and will guide you on when to do the dump .
void DiagnosticsLoggingMemoryLogger()
{
    MemoryLogger::Start();
    auto config = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
    auto recognizer = SpeechRecognizer::FromConfig(config);
    std::string logFile = "speech-sdk-log.txt";
    MemoryLogger::Dump(logFile);
    MemoryLogger::Dump(std::cout);
    std::vector<std::string> messages = MemoryLogger::Dump();
    std::cout << "Here are the logs we captured:\n";
    for (std::string message : messages)
    {
        std::cout << message;
    }
    MemoryLogger::Stop();
    MemoryLogger::SetFilters();
}
void DiagnosticsLoggingMemoryLogger ( ) { MemoryLogger :: Start ( ) ; auto config = SpeechConfig :: FromSubscription ( " " , " " ) ; auto recognizer = SpeechRecognizer :: FromConfig ( config ) ; std :: string logFile = " " ; MemoryLogger :: Dump ( logFile ) ; MemoryLogger :: Dump ( std :: cout ) ; std :: vector < std :: string > messages = MemoryLogger :: Dump ( ) ; std :: cout << " \n " ; for ( std :: string message : messages ) { std :: cout << message ; } MemoryLogger :: Stop ( ) ; MemoryLogger :: SetFilters ( ) ; }
Shows how to enable Speech SDK trace logging to memory.
Shows how to enable Speech SDK trace logging to memory .
// Optional - Apply a filter, such that only traces that contain either one of the // filter strings will be logged /*
    std::initializer_list<std::string> filters = { "YourFirstString", "YourSecondString" };
    MemoryLogger::SetFilters(filters);
    */ // Turn on logging to memory // Do your Speech SDK calls... for example: // Define the full path and name of a log file on your local disk // At any time (while still logging or after logging is stopped) you can dump the traces // in memory to a file: // Or to any stream object that is derived from std::ostream. For example, std::cout. // Using std::cout will enable logging to the standard output stream (your console Windows): // Or to a vector of strings, and see the results on the console: // Stop logging to memory // Clear filters if previously set