FirebaseAnalyticsLogStrategy class

A LogStrategy implementation that utilizes Firebase Analytics to log events, errors, and fatal incidents.

This strategy enables detailed tracking and logging of application activities in Firebase Analytics, supporting data-driven decisions and comprehensive monitoring. It integrates seamlessly with Firebase to provide real-time analytics based on the application's operational events.

The strategy supports handling both structured LogEvent instances and simple message logging, adapting to the flexible needs of modern applications.

Example:

var firebaseAnalyticsStrategy = FirebaseAnalyticsLogStrategy(logLevel: LogLevel.info);
var logger = StrategicLogger(strategies: [firebaseAnalyticsStrategy]);
logger.log("UserLoggedIn");
Inheritance

Constructors

FirebaseAnalyticsLogStrategy({LogLevel logLevel = LogLevel.none, List<LogEvent>? supportedEvents})
Constructs a FirebaseAnalyticsLogStrategy.

Properties

hashCode int
The hash code for this object.
no setterinherited
loggerLogLevel LogLevel
The log level set by the logger using this strategy. Used to determine if a message should be logged.
getter/setter pairinherited
logLevel LogLevel
The minimum log level that this strategy handles for logging.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedEvents List<LogEvent>?
A list of specific LogEvent types that this strategy supports. If null, all events are considered supported.
getter/setter pairinherited

Methods

error({dynamic error, StackTrace? stackTrace, LogEvent? event}) Future<void>
Logs an error with detailed context to Firebase Analytics, categorizing it appropriately based on severity.
override
fatal({dynamic error, StackTrace? stackTrace, LogEvent? event}) Future<void>
Marks an error as fatal and records it to Firebase Analytics, ensuring it is flagged as a critical incident.
override
log({dynamic message, LogEvent? event}) Future<void>
Logs a message or a structured event to Firebase Analytics, facilitating broad and detailed analytics.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldLog({LogEvent? event}) bool
Determines whether a log operation should proceed based on the event and log level.
inherited
toString() String
Provides a string representation of the strategy including its type and log level.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited