edgeAiLog function
The plugin's debug log. Silent in release builds and under
EdgeAiLogLevel.none; in debug builds it prints when level <=
edgeAiLogLevel.
Not every message goes through it: the start-up restore notices go
through restoreNotice (release builds keep them), and some warnings and
notices are printed with print in every build whatever the
level (see EdgeAiLogLevel).
- Release builds:
kDebugModeis a compile-timefalse, so the body is dead-code-eliminated. (Callers that interpolate a large/hot variable must still guard the CALL SITE withif (kDebugMode)to avoid building the string in release.) - Debug builds: the message is sanitized for U+FFFD first, so it can't
crash
flutter run(issue #306).
Implementation
void edgeAiLog(String message, {EdgeAiLogLevel level = EdgeAiLogLevel.info}) {
if (!kDebugMode) return;
if (edgeAiLogLevel == EdgeAiLogLevel.none) return;
if (level.index > edgeAiLogLevel.index) return;
debugPrint(sanitizeForLog(message));
}