print method

void print({
  1. SemiLogger? logger,
  2. bool debugMode = true,
})

Log to console this exception

Implementation

void print({SemiLogger? logger, bool debugMode = true}) {
  if (debugMode) {
    var _logger = logger ?? SemiLogger(name: errorCode, debugMode: debugMode);
    final messages = <SemiLogLevelData>[];
    if (message != null) {
      messages.add(SemiLogLevel.error.msg(message!));
    }
    if (time != null) {
      messages.add(SemiLogLevel.error.msg('at ${time!.toIso8601String()}'));
    }
    if (error != null) {
      messages.add(SemiLogLevel.print.msg(error.toString()));
    }
    if (stackTrace != null) {
      messages.add(SemiLogLevel.print.msg(stackTrace.toString()));
    }
    _logger.block(messages, headerSeparator: true);
  }
}