logd_html 0.1.0 copy "logd_html: ^0.1.0" to clipboard
logd_html: ^0.1.0 copied to clipboard

Modern HTML5 log rendering, dynamic dark/light stylesheet, and file handler satellite package for logd.

example/main.dart

import 'package:logd/logd.dart'
    hide DefaultHtmlStylesheet, HtmlEncoder, HtmlFileHandler, HtmlStylesheet;
import 'package:logd_html/logd_html.dart';

void main() async {
  // Required when using logd_html in an asynchronous isolate environment
  registerLogdHtmlSerializers();

  // Configure a logger to write beautiful HTML logs in the background
  Logger.configure(
    'html_demo',
    handlers: [
      HtmlFileHandler.async(
        path: 'logs/app_logs.html',
        title: 'My Application Logs',
      ),
    ],
  );

  final logger = Logger.get('html_demo')
    ..info(
      'Application started successfully.',
      context: {'version': '1.0.0', 'environment': 'production'},
    );

  try {
    throw StateError('Simulated database connection failure');
  } catch (e, stackTrace) {
    logger.error(
      'Failed to connect to database',
      error: e,
      stackTrace: stackTrace,
    );
  }

  // Dispose the handler to flush the isolate cleanly
  await Future.delayed(const Duration(milliseconds: 100));
  print('HTML logs generated at: logs/app_logs.html');
}
3
likes
160
points
52
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Modern HTML5 log rendering, dynamic dark/light stylesheet, and file handler satellite package for logd.

Repository (GitHub)
View/report issues
Contributing

Topics

#logging #html #stylesheet

License

BSD-3-Clause (license)

Dependencies

logd, meta

More

Packages that depend on logd_html