Skip to content

Commit 72a8746

Browse files
test: Enable logs for sample apps (#6191)
Also add a couple of logs for some ViewControllers, so we can look at logs in the test org.
1 parent b074ba9 commit 72a8746

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public struct SentrySDKWrapper {
166166
// Experimental features
167167
options.experimental.enableFileManagerSwizzling = !SentrySDKOverrides.Other.disableFileManagerSwizzling.boolValue
168168
options.experimental.enableUnhandledCPPExceptionsV2 = true
169+
options.experimental.enableLogs = true
169170
}
170171

171172
func configureInitialScope(scope: Scope, options: Options) -> Scope {

Samples/iOS-Swift/iOS-Swift/ErrorsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class ErrorsViewController: UIViewController {
1212
override func viewDidLoad() {
1313
super.viewDidLoad()
1414

15+
SentrySDK.logger.info("ErrorsViewController.viewDidLoad")
16+
1517
if SentrySDKOverrides.Feedback.useCustomFeedbackButton.boolValue {
1618
let button = SentrySDKWrapper.shared.feedbackButton
1719
view.addSubview(button)
@@ -22,6 +24,9 @@ class ErrorsViewController: UIViewController {
2224

2325
override func viewDidAppear(_ animated: Bool) {
2426
super.viewDidAppear(animated)
27+
28+
SentrySDK.logger.info("ErrorsViewController.viewDidAppear")
29+
2530
SentrySDK.reportFullyDisplayed()
2631

2732
if SentrySDKOverrides.Feedback.injectScreenshot.boolValue {

Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class ExtraViewController: UIViewController {
2222

2323
override func viewDidLoad() {
2424
super.viewDidLoad()
25+
26+
SentrySDK.logger.info("ExtraViewController.viewDidLoad")
27+
2528
if let uiTestName = ProcessInfo.processInfo.environment["--io.sentry.ui-test.test-name"] {
2629
uiTestNameLabel.text = uiTestName
2730
uiTestNameLabel.isHidden = false
@@ -35,6 +38,8 @@ class ExtraViewController: UIViewController {
3538
override func viewDidAppear(_ animated: Bool) {
3639
super.viewDidAppear(animated)
3740

41+
SentrySDK.logger.info("ExtraViewController.viewDidAppear")
42+
3843
SentrySDK.configureScope { (scope) in
3944
let dict = scope.serialize()
4045

@@ -75,6 +80,8 @@ class ExtraViewController: UIViewController {
7580
}
7681

7782
@IBAction func anrDeadlock(_ sender: UIButton) {
83+
SentrySDK.logger.info("ExtraViewController.anrDeadlock")
84+
7885
highlightButton(sender)
7986
let queue1 = DispatchQueue(label: "queue1")
8087
let queue2 = DispatchQueue(label: "queue2")
@@ -91,6 +98,8 @@ class ExtraViewController: UIViewController {
9198
}
9299

93100
@IBAction func anrFullyBlocking(_ sender: UIButton) {
101+
SentrySDK.logger.info("ExtraViewController.anrFullyBlocking.started")
102+
94103
highlightButton(sender)
95104
let buttonTitle = self.anrFullyBlockingButton.currentTitle
96105
var i = 0
@@ -103,6 +112,8 @@ class ExtraViewController: UIViewController {
103112
}
104113

105114
self.anrFullyBlockingButton.setTitle(buttonTitle, for: .normal)
115+
116+
SentrySDK.logger.info("ExtraViewController.anrFullyBlocking.finished")
106117
}
107118

108119
@IBAction func anrFillingRunLoop(_ sender: UIButton) {
@@ -126,6 +137,8 @@ class ExtraViewController: UIViewController {
126137
}
127138

128139
@IBAction func start100Threads(_ sender: UIButton) {
140+
SentrySDK.logger.info("ExtraViewController.start100Threads")
141+
129142
highlightButton(sender)
130143
for _ in 0..<100 {
131144
Thread.detachNewThread {
@@ -135,6 +148,8 @@ class ExtraViewController: UIViewController {
135148
}
136149

137150
@IBAction func highCPULoad(_ sender: UIButton) {
151+
SentrySDK.logger.info("ExtraViewController.highCPULoad")
152+
138153
highlightButton(sender)
139154
dispatchQueue.async {
140155
while true {

0 commit comments

Comments
 (0)