logEvent method

void logEvent(
  1. LogEvent logEvent
)
inherited

Implementation

void logEvent(LogEvent logEvent) {
  if (!_active) {
    throw ArgumentError('Logger has already been closed.');
  }

  for (var callback in _logCallbacks) {
    callback(logEvent);
  }

  if (_filter.shouldLog(logEvent)) {
    var output = _printer.log(logEvent);

    if (output.isNotEmpty) {
      var outputEvent = OutputEvent(logEvent, output);
      // Issues with log output should NOT influence
      // the main software behavior.
      try {
        for (var callback in _outputCallbacks) {
          callback(outputEvent);
        }
        _output.output(outputEvent);
      } catch (e, s) {
        print(e);
        print(s);
      }
    }
  }
}