Logging
TeadsLog controls the plugin's Dart-side logging. It is quiet by default — you see
warnings and errors, not a stream of diagnostics you never asked for.
Log Levels
enum LogLevel { none, error, warn, info, debug }
Setting TeadsLog.level shows that level and everything less verbose than it:
| Level | Shows | Use for |
|---|---|---|
none | nothing | Silencing the SDK completely |
error | errors | Production, if you want failures only |
warn | errors + warnings | The default |
info | + lifecycle events | Verifying an integration works |
debug | + fine-grained tracing | Diagnosing a specific problem |
// While developing:
TeadsLog.level = LogLevel.debug;
// Silence entirely:
TeadsLog.level = LogLevel.none;
Set it once, wherever you configure the SDK:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (kDebugMode) {
TeadsLog.level = LogLevel.debug;
}
await TeadsSdk.configure('YOUR_APP_KEY');
runApp(const MyApp());
}
Default Output
Lines print via debugPrint, tagged with the component that emitted them:
[Feed] debug: bridge URL built for widgetId=MB_1
[Recommendations] info: fetch: got 8 recommendation(s) for widgetId=SDK_1
[Interstitial] error: interstitial.create failed — PlatformException(...)
Tags include Feed, Banner, Interstitial, Recommendations and
RecommendationsViewability, which makes filtering easy.
Routing Logs Into Your Own Pipeline
Assign a sink to send SDK logs wherever your app's logs already go — Crashlytics, Sentry, Datadog, your own logger:
typedef TeadsLogSink = void Function(
LogLevel level,
String tag,
String message,
Object? error,
StackTrace? stackTrace,
);
TeadsLog.sink = (level, tag, message, error, stackTrace) {
MyLogger.log(
level: _mapLevel(level),
message: '[Teads/$tag] $message',
error: error,
stackTrace: stackTrace,
);
};
The sink is only called for lines that already passed the level filter. error and
stackTrace are non-null only for error-level calls that were given them.
Reporting SDK errors to crash reporting
TeadsLog.sink = (level, tag, message, error, stackTrace) {
if (level == LogLevel.error && error != null) {
FirebaseCrashlytics.instance.recordError(
error,
stackTrace,
reason: '[Teads/$tag] $message',
fatal: false,
);
}
if (kDebugMode) {
debugPrint('[Teads/$tag] ${level.name}: $message');
}
};
Assigning a sink stops the default debugPrint output. Call debugPrint from your own
sink if you still want console lines, as above.
Native Logs
TeadsLog covers the plugin's Dart side only. The native SDKs log separately, and
TeadsLog.level does not affect them:
Android
adb logcat | grep -i teads
iOS
Open the Xcode console and filter for Teads.
Neither native SDK exposes a logging contract worth plumbing through: Android's is internal-only with no interception point, and iOS's covers only WebView console output with no level control and no Android counterpart. Building this in Dart keeps diagnostics identical on both platforms.
Debugging Checklist
When a placement is not behaving:
TeadsLog.level = LogLevel.debug- Look for an
error-level line from the relevant tag - For Feed, make sure
onUnsupportedis wired up — page-reported problems arrive there, not in the log - Check the native logs too, for the wrapped placements (Media, Banner, Interstitial)
- Confirm
TeadsSdk.configure()did not throw
Production Recommendations
- Leave the level at its default (
warn), or seterror - Do not ship
LogLevel.debug— it is verbose and can include request details - Route errors to your crash reporter so no-fill and failure patterns are visible
- Never log full consent strings in a production build
TeadsLog.level = kDebugMode ? LogLevel.debug : LogLevel.error;
Related Documentation
- Troubleshooting Guide — common issues
- Placement Events — the event callbacks
- Settings & Configuration — every config field