log method
Emits entry to this printer's destination.
Implementation contract:
- Synchronous. This call must not return a
Future— theHyperLoggeremit 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 (seeRotatingFilePrinter'sonError). - Should not throw.
HyperLoggercontains synchronous printer failures and reports them through its configured pipeline error handler, but a caller invoking log directly receives the exception. Wrap I/O intry/catchand 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 —
ThrottledPrinteris 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);
}
}