ColorizeLogger class
A utility class for logging messages with ANSI color codes.
The ColorizeLogger class provides methods to log messages with different
log levels, such as error, warning, success, info, and debug. Each log level
is associated with a specific color for better visibility in the terminal.
Example usage:
final logger = ColorizeLogger(environment);
logger.logInfo("This is an informational message.");
logger.logError("This is an error message.");
The logger writes messages to both the terminal and a log file named distribution.log.
Verbose logging can be controlled via the provided Environment instance.
Constructors
- ColorizeLogger(Environment environment)
-
Initializes the
ColorizeLoggerwith the givenenvironment. Theenvironmentparameter is used to determine if verbose logging is enabled. If verbose logging is enabled, all log messages will be displayed.
Properties
- environment → Environment
-
The current environment configuration
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
log(
String message, {LogLevel color = LogLevel.info}) → void -
Logs a message with the specified
color. -
logDebug(
String message) → void - Logs a debug message in the default terminal color.
-
logError(
String message) → void - Logs an error message in red.
-
logInfo(
String message) → void - Logs an informational message in green.
-
logSuccess(
String message) → void - Logs a success message in green.
-
logWarning(
String message) → void - Logs a warning message in yellow.
-
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