LoggerService<T> class
abstract
Abstract service interface for structured logging throughout the application.
Usage Guidelines
Accessing the Logger
Obtain the logger via dependency injection from LittleFishCore:
final logger = LittleFishCore.instance.get<LoggerService>();
For classes extending LittleFishService, use the inherited logger getter.
Caller Parameter
Always pass this (or the class Type for static methods) as the caller
parameter to enable log traceability:
logger.debug(this, 'Operation completed');
logger.error(MyClass, 'Static method failed', error: e, stackTrace: st);
Error Logging
All catch blocks MUST log errors to ensure visibility in observability:
} catch (e, st) {
logger.error(this, 'Description of failure', error: e, stackTrace: st);
}
Security
Never log sensitive data such as tokens, passwords, or full request payloads. Log only identifiers and metadata needed for debugging.
Log Levels
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- kInstance ↔ T?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings → LoggerSettings?
-
no setter
Methods
-
debug(
dynamic caller, String message, {dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void - Logs a debug message.
-
error(
dynamic caller, String message, {dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void - Logs an error message.
-
info(
dynamic caller, String message, {dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void - Logs an info message.
-
initialize(
{required LoggerSettings settings}) → Future< void> -
log(
dynamic caller, {required LogLevel level, required String message, dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onInitialise(
LoggerSettings settings) → void -
toString(
) → String -
A string representation of this object.
inherited
-
verbose(
dynamic caller, String message, {dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void - Logs a verbose message.
-
warning(
dynamic caller, String message, {dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void - Logs a warning message.
-
wtf(
dynamic caller, String message, {dynamic error, StackTrace? stackTrace, Map< String, dynamic> ? extra}) → void - Logs a severe error message (What a Terrible Failure).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited