debugLog function
void
debugLog({})
Logs a message with optional color, tag, and additional details.
type
: The class or type generating the log (optional).tag
: A custom tag for the log (default is 'Debugger').message
: The log message (default is 'LOG').color
: The ANSI color for the log message (default is no color).error
: An optional error object to log.stackTrace
: An optional stack trace to log.
Implementation
void debugLog({
Type? type,
String tag = 'Debugger',
String message = "No Message",
LogColor color = LogColor.reset,
LogColor tagColor = LogColor.reset,
Object? error,
StackTrace? stackTrace,
}) {
String formattedMessage = '${color.code}$message${LogColor.reset.code}';
String formattedName = '${tagColor.code}${type ?? tag}${LogColor.reset.code}';
log(
formattedMessage,
name: formattedName,
error: error,
stackTrace: stackTrace,
);
}