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(true);
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 isVerbose
flag.
Constructors
- ColorizeLogger.new(bool isVerbose)
- Creates a new ColorizeLogger instance.
Properties
Methods
-
log(
String message, {LogLevel level = LogLevel.info}) → void - Logs a message with the specified level and color.
-
logDebug(
String message) → void -
Logs a debug message with
[VERBOSE]
prefix. Only shown when verbose logging is enabled. -
logEmpty(
) → void - Logs an empty line to stdout for better message separation.
-
logError(
String message) → void -
Logs an error message in red color with
[ERROR]
prefix. -
logErrorVerbose(
String message) → void -
Logs a verbose error message in red color with
[ERROR]
prefix. Only shown when verbose logging is enabled. -
logInfo(
String message) → void -
Logs an informational message in orange color with
[INFO]
prefix. -
logSuccess(
String message) → void -
Logs a success message in green color with
[SUCCESS]
prefix. -
logWarning(
String message) → void -
Logs a warning message in yellow color with
[WARNING]
prefix. -
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