Console logs
Bugsee records the app's log output and attaches it to every report, so you can read what the app was saying before something went wrong.
Automatic capture
With BugseeOptionCaptureLogs on (the default), Bugsee records:
- standard output and standard error —
print,NSLog,printfand anything else written there, from Swift and Objective-C alike; - CocoaLumberjack messages, when the app
uses
DDLog; consoleoutput of pages inWKWebView, recorded at theDebuglevel, whileBugseeOptionCaptureWebViewAdvancedis on (the default);- console output that the React Native, Flutter and Unity SDKs forward.
Lines you send with +[Bugsee log:] are recorded whatever this option
says.
Options
| Option | BugseeOptions property | Default | Effect |
|---|---|---|---|
BugseeOptionCaptureLogs | captureLogs | YES | Automatic capture of the sources above |
BugseeOptionCaptureLogsLevel | — | BugseeLogLevelVerbose | Lines more verbose than this level are dropped |
BugseeOptionCaptureOSLogs | captureOSLogs | NO | Accepted and ignored |
BugseeOptionCaptureLogsLevel applies to every line, including those sent with +[Bugsee log:].
Console output (print, NSLog, printf, stdout and stderr) is recorded at the Debug level,
whatever it says, so any level stricter than BugseeLogLevelDebug drops all console output —
error messages included — and keeps only lines that carry their own level, such as those sent with
+[Bugsee log:level:]. A line with no level (BugseeLogLevelInvalid) is always kept.
- Objective-C
- Swift
NSDictionary *options = @{
BugseeOptionCaptureLogsLevel : @(BugseeLogLevelWarning),
};
[Bugsee launchWithToken:@"<your_app_token>" andOptions:options];
let options: [String: Any] = [
BugseeOptionCaptureLogsLevel: BugseeLogLevelWarning.rawValue,
]
Bugsee.launch(token: "<your_app_token>", dictionaryOptions: options)
Send your own log lines
+[Bugsee log:] writes a line straight into the recording, with a level you can filter by in the
report viewer.
- Objective-C
- Swift
// Default level: info
[Bugsee log:@"Cart restored from disk"];
// Explicit level
[Bugsee log:@"Coupon service is slow" level:BugseeLogLevelWarning];
// Also run the line through your log filter
[Bugsee log:@"User entered card details" level:BugseeLogLevelInfo requiresFiltering:YES];
// Default level: info
Bugsee.log("Cart restored from disk")
// Explicit level
Bugsee.log("Coupon service is slow", level: BugseeLogLevelWarning)
// Also run the line through your log filter
Bugsee.log("User entered card details", level: BugseeLogLevelInfo, requiresFiltering: true)
- Lines sent with
log:bypass your log filter by default; passrequiresFiltering:YESto run them through it. Every other source always goes through the filter. - Lines are recorded once the SDK status is
Launched. A line sent earlier — while the SDK is stopped, while a launch waits for the app to become active, or while it is stillLaunching— may be lost.
BugseeLogLevel values
| Value | Meaning |
|---|---|
BugseeLogLevelError | Errors |
BugseeLogLevelWarning | Warnings |
BugseeLogLevelInfo | Informational messages (the default of log:) |
BugseeLogLevelDebug | Debug output |
BugseeLogLevelVerbose | Everything |
BugseeLogLevelInvalid | No level |
CocoaLumberjack without automatic capture
CocoaLumberjack is captured automatically while BugseeOptionCaptureLogs is on. If you turn
automatic capture off but still want CocoaLumberjack messages, add Bugsee's logger to DDLog:
- Objective-C
- Swift
[DDLog addLogger:BugseeLumberjackLogger];
// or
[BugseeLogger install];
BugseeLogger.install()
Do not add it while automatic capture is on: every message would be recorded twice, and Bugsee logs
a warning saying so. To change how the messages this logger forwards are formatted, set logFormatter on
BugseeLogger.sharedInstance() to a CocoaLumberjack log formatter. It does not affect automatic
capture.
Filtering log lines
To redact or drop lines before they are recorded, install a log filter with
setLogEventFilter: or the bugseeFilterLog:completionHandler: delegate method. See
Privacy: console logs.