AppLogger class abstract
Abstract logger interface for application-wide logging.
Provides a consistent logging API with support for different severity levels (debug, info, warn, error) and structured metadata via extras.
Implementations handle log persistence, formatting, and routing to appropriate destinations such as the console or remote services.
Example implementation:
class ConsoleLogger extends AppLogger {
@override
void info(String message, {Map<String, Object?>? extras}) {
print('[INFO] $message ${extras ?? ''}');
}
}
See also:
- SentryAppLogger for the production error tracking implementation.
- Implementers
Constructors
- AppLogger()
-
Creates a constant logger instance.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
debug(
String message, {Map< String, Object?> ? extras}) → void - Logs a debug-level message with optional structured metadata.
-
error(
String message, {Object? error, StackTrace? stackTrace, Map< String, Object?> ? extras}) → void - Logs an error for failures and exceptions.
-
info(
String message, {Map< String, Object?> ? extras}) → void - Logs an informational message with optional structured metadata.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
warn(
String message, {Object? error, StackTrace? stackTrace, Map< String, Object?> ? extras, bool escalate}) → void - Logs a warning for a potentially problematic situation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited