LogsLevel enum
LoggerConfig class and Log utility
This setup allows you to configure the logger comprehensively through the LoggerConfig
class,
including setting the log level. This approach keeps your configuration centralized and easy to manage.
Usage:
- Define the configuration for your logger using
LoggerConfig
:
final loggerConfig = LoggerConfig(
debugOnly: true, // Log only in debug mode
methodCount: 3, // Number of method calls to be displayed
errorMethodCount: 5, // Number of method calls if stacktrace is provided
lineLength: 100, // Width of the output
colors: true, // Colorful log messages
printEmojis: true, // Print an emoji for each log message
printTime: true, // Should each log print contain a timestamp
logLevel: LogLevel.warning, // Set the logging level
);
- Initialize the logger with the configuration:
Log.init(loggerConfig);
- Use the
Log
class to log messages:
Log.d("This is a debug message");
Log.e("This is an error message");
Log.i("This is an info message");
Log.t("This is a trace message");
Log.f("This is a fatal message");
Values
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited