FirebaseCrashlyticsLogStrategy class
A LogStrategy implementation that logs messages and errors to Firebase Crashlytics.
This strategy provides the functionality to send log messages and detailed error reports, including stack traces, to Firebase Crashlytics. It can be configured with a specific log level and can handle both general log messages and structured LogEvent instances tailored for Crashlytics.
The strategy distinguishes between general messages, errors, and fatal errors, ensuring that each type of log is appropriately reported to Firebase Crashlytics.
Example:
var crashlyticsStrategy = FirebaseCrashlyticsLogStrategy(
logLevel: LogLevel.error,
);
var logger = StrategicLogger(strategies: [crashlyticsStrategy]);
logger.error('Example error', stackTrace: StackTrace.current);
- Inheritance
-
- Object
- LogStrategy
- FirebaseCrashlyticsLogStrategy
Constructors
-
FirebaseCrashlyticsLogStrategy({LogLevel logLevel = LogLevel.none, List<
LogEvent> ? supportedEvents}) - Constructs a FirebaseCrashlyticsLogStrategy.
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> -
Records an error or a structured event with an error to Firebase Crashlytics.
override
-
fatal(
{dynamic error, StackTrace? stackTrace, LogEvent? event}) → Future< void> -
Marks an error as fatal and records it to Firebase Crashlytics.
override
-
log(
{dynamic message, LogEvent? event}) → Future< void> -
Logs a message or a structured event to Firebase Crashlytics.
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