LoggerMixin mixin
Mixin that provides a shared Logger instance and context-aware shortcut methods with single-character names for brevity.
Mix this into any class to gain concise logging methods that automatically attach the class name as the log context:
class AuthService with LoggerMixin {
Future<void> signIn(String email) async {
await i('Sign-in attempt for $email');
// ...
}
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- loggerContext → String
-
Context label for log events. Defaults to the runtime type name.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
d(
Object message, {Object? error, StackTrace? stackTrace}) → Future< void> - Emits a LogLevel.debug event.
-
e(
Object message, {Object? error, StackTrace? stackTrace}) → Future< void> - Emits a LogLevel.error event.
-
f(
Object message, {Object? error, StackTrace? stackTrace}) → Future< void> - Emits a LogLevel.fatal event.
-
i(
Object message, {Object? error, StackTrace? stackTrace}) → Future< void> - Emits a LogLevel.info event.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
t(
Object message, {Object? error, StackTrace? stackTrace}) → Future< void> - Emits a LogLevel.trace event.
-
toString(
) → String -
A string representation of this object.
inherited
-
w(
Object message, {Object? error, StackTrace? stackTrace}) → Future< void> - Emits a LogLevel.warn event.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- logger → Logger
-
Shared Logger instance used by all classes that mix in LoggerMixin.
final