fetchLogPrinterService function Core - Logging System

LogPrinterService fetchLogPrinterService()

Resolves the registered LogPrinterService from get_it.

Used internally by LoggerObjectBase.sendLog to obtain the configured log service.

If LogPrinterService is not registered yet, a default simple printer is registered. You should still call registerLogPrinter at app startup to keep behavior explicit and predictable.

Implementation

LogPrinterService fetchLogPrinterService() {
  final getIt = GetIt.instance;
  if (!getIt.isRegistered<LogPrinterService>()) {
    registerLogPrinter(const LogSimplePrint(), config: const ConfigLog(enableLog: true));
  }
  return getIt<LogPrinterService>();
}