live_log_care 2.3.1 copy "live_log_care: ^2.3.1" to clipboard
live_log_care: ^2.3.1 copied to clipboard

Redaction-safe logging for Flutter: build-mode gated (silent in release) and auto-scrubs passwords, tokens, cookies, OTPs and PII from logs, Dio and Bloc.

example/lib/main.dart

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:live_log_care/live_log_care.dart';

void main() {
  // ── Fast config (same pattern as production Mdarj apps) ───────────────────
  // Use LiveLog.d/i/w/e(...) everywhere instead of print/debugPrint.
  // clean(): copy-friendly Debug Console output; secrets shown in DEBUG only.
  LiveLog.configure(LiveLogConfig.clean());
  Bloc.observer = LiveLogBlocObserver();

  // Optional: app-specific secret keys beyond the built-in list.
  LogRedactor.addSensitiveKeys(['iban', 'card_holder']);

  // Redaction-safe Dio logger (pretty JSON body is the default).
  final dio = Dio()..interceptors.add(RedactingDioInterceptor());

  LiveLog.i('app started');
  LiveLog.d({'login': 'user@example.com', 'password': 'hunter2'});

  runApp(ExampleApp(dio: dio));
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key, required this.dio});

  final Dio dio;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'live_log_care',
      home: Scaffold(
        appBar: AppBar(title: const Text('live_log_care')),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              try {
                throw StateError('boom');
              } catch (e, s) {
                LiveLog.e('button tap failed', error: e, stackTrace: s);
              }
            },
            child: const Text('Log a redacted error'),
          ),
        ),
      ),
    );
  }
}
1
likes
160
points
117
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Redaction-safe logging for Flutter: build-mode gated (silent in release) and auto-scrubs passwords, tokens, cookies, OTPs and PII from logs, Dio and Bloc.

Repository (GitHub)
View/report issues

Topics

#logging #security #redaction #dio

License

MIT (license)

Dependencies

dio, flutter, flutter_bloc

More

Packages that depend on live_log_care