log method

void log(
  1. LogEntry entry
)

Logs a structured entry with the specified level.

Implementation

void log(LogEntry entry) {
  if (!enabled || entry.level.value < minimumLevel.value) {
    return;
  }

  // Check sampling rules
  final sampler = samplers[entry.category];
  if (sampler != null) {
    if (!sampler.shouldLog(entry)) {
      return;
    }
    sampler.recordLog(entry);
  }

  // Format and output the log entry via the configured sink.
  final formatted = _formatEntry(entry);
  _sink.write(entry, formatted);
}