live_log_care library
Redaction-safe logging for Flutter.
A single import gives you:
- LiveLog — a static, build-mode-gated logging facade.
- LiveLogConfig / LogLevel — optional startup configuration.
- LogRedactor — scrubs secrets/PII from anything before it is logged.
- RedactingDioInterceptor — a redaction-safe
Diologger. - LiveLogBlocObserver — routes Bloc/Cubit events through LiveLog.
- CrashSink — pluggable hook for release
errors (Crashlytics/Sentry).
The logging engine is self-contained (no third-party logger dependency). Customize it with bundled — or your own — building blocks:
- Printers: BoxedPrinter (default), CleanPrinter.
- Outputs: ConsoleOutput (default), DevLogOutput, MultiOutput, FileOutput.
- Filters: ThresholdFilter, or any LogFilter.
- HttpLogRecord — structured HTTP log payload for custom formatters.
Classes
- BoxedPrinter
-
The default printer: a bordered, color-coded box — the familiar
"pretty" log look.
Map/Iterablemessages are shown as indented JSON. - CleanPrinter
-
A borderless, color-free printer.
Map/Iterablemessages render as indented JSON; any error/stack trace is appended on its own lines. - ConsoleOutput
- The default output: writes each line to the console via debugPrint, so it shows up wherever your app's normal logs do (terminal, Logcat, Debug Console). Multi-line boxes render exactly as today.
- CrashSink
-
A pluggable destination for
error-level logs in release builds. - DevLogOutput
-
Writes each log as a single
dart:developerevent. - FileOutput
-
Web/WASM stub. Imports no
dart:io, so it never drags platform code into a web build; constructing it throws to make the unsupported use obvious. - HttpLogRecord
- A structured HTTP log payload emitted by RedactingDioInterceptor and rendered by CleanPrinter when CleanPrinter.decorateHttp is enabled.
- LiveLog
- Centralized, redaction-safe logging facade.
- LiveLogBlocObserver
-
A
BlocObserverthat routes all Bloc/Cubit lifecycle and error events through LiveLog, so they are automatically build-mode gated and redacted. - LiveLogConfig
- Immutable startup configuration for LiveLog. Pass to LiveLog.configure.
- LogEvent
- A single log record handed to a LogPrinter.
- LogFilter
- Decides whether a LogEvent is emitted at all. Implement for custom gating (e.g. sampling, per-tag rules); the default is ThresholdFilter.
- LogOutput
-
Receives formatted OutputEvents and writes them somewhere (console, a
file, a crash backend, several at once). Bundled options are
ConsoleOutput(the default),DevLogOutput,MultiOutputandFileOutput. - LogPrinter
-
Formats a LogEvent into the lines that a LogOutput will write.
Implement for a fully custom look; bundled options are
BoxedPrinter(the default) andCleanPrinter. - LogRedactor
- Scrubs sensitive values (passwords, tokens, cookies, OTPs, national IDs, auth headers, card numbers, ...) out of anything before it is logged.
- MultiOutput
- Fans a single OutputEvent out to several outputs — e.g. log to the console and a file at once.
- OutputEvent
- The formatted lines a LogPrinter produced for an origin event, handed to a LogOutput.
- RedactingDioInterceptor
-
A redaction-safe replacement for
PrettyDioLogger/LogInterceptor. - ThresholdFilter
- Emits an event only when its level is at or above min.
Enums
- HttpLogKind
- The phase of an HTTP transaction represented by an HttpLogRecord.
- LogLevel
- Severity levels, ordered by weight (lower = more verbose).