Skip to main content

herald_log 1.2.0 copy "herald_log: ^1.2.0" to clipboard
herald_log: ^1.2.0 copied to clipboard

A Herald vendor that prints every event, property and call as a readable record, for debug builds.

example/herald_log_example.dart

import 'package:herald/herald.dart';
import 'package:herald_log/herald_log.dart';

final class const CheckoutStarted(final String plan, final int seats) extends Event {
  @override
  String get name => 'checkout_started';

  @override
  Map<String, AnalyticsValue> get parameters => {'plan': .string(plan), 'seats': .int(seats)};
}

Future<void> main() async {
  // In a Flutter app, pass debugPrint and register the provider in debug builds only.
  const AnalyticsLogger logger = print;
  final tracker = LogAnalyticsTrackerService(
    eventTrackerFactory: CompositeLogEventTrackerFactory([
      ScreenViewLogEventTrackerFactory(logger),
      GenericLogEventTrackerFactory(logger),
    ]),
    propertySetterFactory: CompositeLogPropertySetterFactory([
      GenericLogPropertySetterFactory(logger),
    ]),
  );
  final service = LogAnalyticsService(logger);
  final herald = Herald(
    providers: [
      HeraldProvider(
        name: 'log',
        events: tracker,
        properties: tracker,
        identity: service,
        lifecycle: service,
        consent: service,
      ),
    ],
  );

  await herald.start();
  await herald.track(const CheckoutStarted('pro', 3));
}
0
likes
160
points
561
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

A Herald vendor that prints every event, property and call as a readable record, for debug builds.

Repository (GitHub)
View/report issues
Contributing

Topics

#analytics #logging #debugging

License

Apache-2.0 (license)

Dependencies

herald

More

Packages that depend on herald_log