Flutter

Send logs from Flutter and Dart apps to BunnyLogs in real time using the bunnylogs_flutter package — fire-and-forget HTTP POSTs, no platform-specific code required.

Add the package
flutter pub add bunnylogs_flutter

Or add it manually to pubspec.yaml:

dependencies:
  bunnylogs_flutter: ^0.1.0

Then run:

flutter pub get
Standalone usage

The simplest approach — no extra dependencies needed:

import 'package:bunnylogs_flutter/bunnylogs_flutter.dart';

final logger = BunnyLogger(uuid: '<your-uuid>');

logger.info('User signed in: $userId');
logger.warning('Cache miss — fetching from network');
logger.error('Payment failed: $error');

Replace <your-uuid> with the UUID from your stream URL (https://bunnylogs.com/live/<uuid>).

Integration with the logger package

Use BunnyLogsOutput as a LogOutput alongside ConsoleOutput to keep terminal output while also shipping to BunnyLogs:

import 'package:logger/logger.dart';
import 'package:bunnylogs_flutter/bunnylogs_flutter.dart';

final log = Logger(
  filter: kDebugMode ? DevelopmentFilter() : ProductionFilter(),
  output: MultiOutput([
    ConsoleOutput(),
    BunnyLogsOutput(uuid: '<your-uuid>'),
  ]),
  printer: SimplePrinter(printTime: false),
);

log.i('Server started');
log.w('Cache miss — fetching from network');
log.e('Payment failed', error: e, stackTrace: s);

ProductionFilter suppresses trace and debug messages in release builds automatically.

Configuration

Both BunnyLogger and BunnyLogsOutput accept the same options:

ParameterDefaultDescription
uuidrequiredLogspace UUID from your stream URL
program'flutter'Identifies the source in the log stream
minLevelBunnyLevel.verboseDrops records below this level
enabledtrueSet to false to disable all shipping
endpoint'https://bunnylogs.com'Override for self-hosted instances

Example — only ship warnings and above in production:

final logger = BunnyLogger(
  uuid: '<your-uuid>',
  minLevel: BunnyLevel.warning,
  enabled: !kDebugMode,
);
Per-feature loggers

Create separate logger instances per feature to distinguish sources in the program field:

final networkLog = BunnyLogger(uuid: '<your-uuid>', program: 'flutter/network');
final authLog    = BunnyLogger(uuid: '<your-uuid>', program: 'flutter/auth');
final uiLog      = BunnyLogger(uuid: '<your-uuid>', program: 'flutter/ui');
Log levels
BunnyLevel / logger LevelBunnyLogs level
verbose / traceVERBOSE
debugDEBUG
infoINFO
warningWARN
error / fatalERROR
Notes
  • All HTTP calls are fire-and-forget — output() and the BunnyLogger methods never block the UI thread.
  • The http package works on Android, iOS, macOS, Linux, Windows, and web with no additional configuration.
  • Store the UUID in a --dart-define build variable or a secrets file rather than hardcoding it in source.
  • If your app targets Flutter Web, requests use XMLHttpRequest under the hood — BunnyLogs serves a permissive CORS policy on /live/<uuid> so browser POSTs work out of the box.
  • Set up an Alert in BunnyLogs matching level=ERROR and program starts with flutter to get notified on errors via Slack, Telegram, or Discord.