@kognifai/cogsengine
    Preparing search index...

    Logging

    The logging functionality found in Cogs::Logging can be used to gather output from your program and pipe it through a controlled interface.

    To use logging the developer must:

    • Include the logging headers.
    • Create a logger instance
    • Use the appropriate methods, or preferably the logging macros provided.
    
    #include 
    
    namespace
    {
      // Create a log instance to send our output to.
      Cogs::Logging::Log log = Cogs::Logging::getLogger("MyLogger");
      
      // Set up a callback function to handle log messages.
      void printfCallback(const char * message, const char * source, int category)
      {
        printf("[%d][%s][%s]", category, source, message);
      }
    }
    
    int main()
    {
      // Set the callback function so that log output will be sent here
      Cogs::Logging::setLoggerCallback(printfCallback);
      
      // Log a message with the debug category.
      LOG_DEBUG(log, "Debug message.");
    
      // Log a message with the info category, formatting text.
      LOG_INFO(log, "Some numeric info: %d", 123);
      ...
    }