Skip to main content

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, printf and anything else written there, from Swift and Objective-C alike;
  • CocoaLumberjack messages, when the app uses DDLog;
  • console output of pages in WKWebView, recorded at the Debug level, while BugseeOptionCaptureWebViewAdvanced is 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​

OptionBugseeOptions propertyDefaultEffect
BugseeOptionCaptureLogscaptureLogsYESAutomatic capture of the sources above
BugseeOptionCaptureLogsLevel—BugseeLogLevelVerboseLines more verbose than this level are dropped
BugseeOptionCaptureOSLogscaptureOSLogsNOAccepted 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.

NSDictionary *options = @{
BugseeOptionCaptureLogsLevel : @(BugseeLogLevelWarning),
};

[Bugsee launchWithToken:@"<your_app_token>" andOptions: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.

// 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];
  • Lines sent with log: bypass your log filter by default; pass requiresFiltering:YES to 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 still Launching — may be lost.

BugseeLogLevel values​

ValueMeaning
BugseeLogLevelErrorErrors
BugseeLogLevelWarningWarnings
BugseeLogLevelInfoInformational messages (the default of log:)
BugseeLogLevelDebugDebug output
BugseeLogLevelVerboseEverything
BugseeLogLevelInvalidNo 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:

[DDLog addLogger:BugseeLumberjackLogger];

// or
[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.

Found an issue, typo, or wrong statement on this page? Report it now →