debugLog function
void
debugLog({
- required DebugLoggingSettings debugLoggingSettings,
- required String className,
- required String method,
- String? name,
- String? id,
- dynamic args,
Implementation
void debugLog(
{required DebugLoggingSettings debugLoggingSettings,
required String className,
required String method,
String? name,
String? id,
dynamic args}) {
if (debugLoggingSettings.enabled) {
for (var regExp in debugLoggingSettings.excludeFilter) {
if (regExp.hasMatch(method)) return;
}
var maxLogMessageLength = debugLoggingSettings.maxLogMessageLength;
String message =
"(${Util.isWeb ? 'Web' : defaultTargetPlatform.name}) ${name ?? className}" +
(id != null ? ' ID $id' : '') +
' calling "' +
method.toString() +
'" using ' +
args.toString();
if (maxLogMessageLength >= 0 && message.length > maxLogMessageLength) {
message = message.substring(0, maxLogMessageLength) + '...';
}
if (!debugLoggingSettings.usePrint) {
developer.log(message, name: className);
} else {
print('[${className}] $message');
}
}
}