我要评分
获取效率
正确性
完整性
易理解

SetExternalLogFunc

Scenario Description

The independent log tool can output different types of logs based on log levels, excluding vector information and sensitive information. You can call the log API to output logs as required.

Log levels:

  • DEBUG = 0
  • INFO = 1
  • WARN = 2
  • ERROR = 3

Logs should include:

  • Information about the successful registration of log API functions
  • Information about the parameter verification failure
  • Information about the operator execution failure

Code Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include "ktfop.h"
#include <iostream>

void KtfopLog(int level, const char *message) 
{   
  std::cout << level << ' ' << message << std::endl;
}

int main()
{
   using namespace ktfop;
   SetExternalLogFunc(KtfopLog);    // Set and register the log printing function.
}