Skip to main content

logd_sqlite 0.1.5 copy "logd_sqlite: ^0.1.5" to clipboard
logd_sqlite: ^0.1.5 copied to clipboard

High-performance SQLite log sink for logd featuring WAL mode, prepared statements, atomic transaction batching, retention policies, and full-text search.

example/main.dart

import 'package:logd/logd.dart';
import 'package:logd_sqlite/logd_sqlite.dart';

void main() async {
  // Always register serializers when using isolates or async handlers
  registerLogdSqliteSerializers();

  // Configure Logger with an async SQLite handler on a background isolate
  final handler = SqliteHandler.async(
    path: 'app_logs.db',
    tableName: 'app_telemetry',
    batchSize: 10,
    walMode: true,
  );

  Logger.configure('main', handlers: [handler]);

  Logger.get('main').info(
    'Application started successfully',
    context: const {'version': '1.0.0', 'environment': 'production'},
  );

  try {
    throw StateError('Database connection attempt timed out');
  } catch (e, stackTrace) {
    Logger.get('main').error(
      'Database connection failed',
      error: e,
      stackTrace: stackTrace,
    );
  }

  // Dispose logger pipeline and handler
  await handler.dispose();
  print('SQLite logs written asynchronously to app_logs.db');
}
3
likes
160
points
409
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

High-performance SQLite log sink for logd featuring WAL mode, prepared statements, atomic transaction batching, retention policies, and full-text search.

Repository (GitHub)
View/report issues
Contributing

Topics

#logging #sqlite #persistence #database #structured-logging

License

BSD-3-Clause (license)

Dependencies

logd, meta, sqlite3

More

Packages that depend on logd_sqlite