log method

  1. @override
void log(
  1. LogEntry entry
)
override

Emits entry to this printer's destination.

Implementation contract:

  • Synchronous. This call must not return a Future — the HyperLogger emit path is synchronous to keep the call site non-blocking. If you need async work (network, file rotation, compression), schedule it off-path inside the implementation and surface failures via your own callback (see RotatingFilePrinter's onError).
  • Should not throw. HyperLogger contains synchronous printer failures and reports them through its configured pipeline error handler, but a caller invoking log directly receives the exception. Wrap I/O in try/catch and route failures to a user-supplied error hook when the printer can provide a more useful recovery policy.
  • No back-pressure. Drop or queue overflow yourself — ThrottledPrinter is one example of a wrapper that does exactly that.

Implementation

@override
void log(LogEntry entry) {
  final message = entry.object;

  if (message is LogMessage) {
    _logStructured(entry, message);
  } else {
    _logAtLevel(entry.level, entry.message);
  }
}