console method

void console({
  1. required String componentName,
  2. required String logs,
  3. TencentCloudChatLogLevel? logLevel,
})

Log a message to the console

componentName represents the name of the component or module where the log message originates from.

logs represents the log message to be logged.

logLevel (optional) represents the log level for the message. If not provided, the default log level will be used.

Implementation

void console({
  required String componentName,
  required String logs,
  TencentCloudChatLogLevel? logLevel,
}) {
  var currentTime = TencentCloudChatIntl.getFormattedTimeString();

  logLevel ??= TencentCloudChatLogLevel.debug;

  var cacheLogs = "TCCF:$currentTime:$componentName:${logLevel.name}:{ $logs }";

  if (kDebugMode) {
    // Print the log message to the console if the app is running in debug mode
    print(cacheLogs);
  }
  if (logLevel.index > TencentCloudChatLogLevel.none.index) {
    _cachedLogList.add(cacheLogs);
  }
}