Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 7f46dd8

Browse files
committed
Unnecessary general log category removed
1 parent 6586c60 commit 7f46dd8

28 files changed

+102
-136
lines changed

DuckDuckGo.xcodeproj/project.pbxproj

-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
AA88D14B252A557100980B4E /* URLRequestExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA88D14A252A557100980B4E /* URLRequestExtension.swift */; };
5050
AA8EDF2424923E980071C2E8 /* URLExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA8EDF2324923E980071C2E8 /* URLExtension.swift */; };
5151
AA8EDF2724923EC70071C2E8 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA8EDF2624923EC70071C2E8 /* StringExtension.swift */; };
52-
AA8EDF2A249268600071C2E8 /* OSLogExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA8EDF29249268600071C2E8 /* OSLogExtension.swift */; };
5352
AA97BF4625135DD30014931A /* ApplicationDockMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA97BF4525135DD30014931A /* ApplicationDockMenu.swift */; };
5453
AA9FF95924A1ECF20039E328 /* Tab.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA9FF95824A1ECF20039E328 /* Tab.swift */; };
5554
AA9FF95B24A1EFC20039E328 /* TabViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA9FF95A24A1EFC20039E328 /* TabViewModel.swift */; };
@@ -149,7 +148,6 @@
149148
AA88D14A252A557100980B4E /* URLRequestExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLRequestExtension.swift; sourceTree = "<group>"; };
150149
AA8EDF2324923E980071C2E8 /* URLExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLExtension.swift; sourceTree = "<group>"; };
151150
AA8EDF2624923EC70071C2E8 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = "<group>"; };
152-
AA8EDF29249268600071C2E8 /* OSLogExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSLogExtension.swift; sourceTree = "<group>"; };
153151
AA97BF4525135DD30014931A /* ApplicationDockMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationDockMenu.swift; sourceTree = "<group>"; };
154152
AA9FF95824A1ECF20039E328 /* Tab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tab.swift; sourceTree = "<group>"; };
155153
AA9FF95A24A1EFC20039E328 /* TabViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabViewModel.swift; sourceTree = "<group>"; };
@@ -605,7 +603,6 @@
605603
AAECA41F24EEA4AC00EFA63A /* IndexPathExtension.swift */,
606604
AA6EF9B2250785D5004754E6 /* NSMenuExtension.swift */,
607605
AA6FFB4324DC33320028F4D0 /* NSViewExtension.swift */,
608-
AA8EDF29249268600071C2E8 /* OSLogExtension.swift */,
609606
AA8EDF2624923EC70071C2E8 /* StringExtension.swift */,
610607
AA8EDF2324923E980071C2E8 /* URLExtension.swift */,
611608
AA88D14A252A557100980B4E /* URLRequestExtension.swift */,
@@ -821,7 +818,6 @@
821818
AA7412B524D1536B00D22FE0 /* MainWindowController.swift in Sources */,
822819
AA9FF95924A1ECF20039E328 /* Tab.swift in Sources */,
823820
AA6FFB4624DC3B5A0028F4D0 /* WebView.swift in Sources */,
824-
AA8EDF2A249268600071C2E8 /* OSLogExtension.swift in Sources */,
825821
AA7412B224D0B3AC00D22FE0 /* TabBarViewItem.swift in Sources */,
826822
AA8EDF2424923E980071C2E8 /* URLExtension.swift in Sources */,
827823
AABEE69824A5FD930043105B /* SuggestionsAPIResult.swift in Sources */,

DuckDuckGo/BrowserTab/View/BrowserTabViewController.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ class BrowserTabViewController: NSViewController {
8585

8686
private func reloadWebViewIfNeeded() {
8787
guard let webView = webView else {
88-
os_log("BrowserTabViewController: Web view is nil", log: OSLog.Category.general, type: .error)
88+
os_log("BrowserTabViewController: Web view is nil", type: .error)
8989
return
9090
}
9191

9292
guard let tabViewModel = tabViewModel else {
93-
os_log("%s: Tab view model is nil", log: OSLog.Category.general, type: .error, className)
93+
os_log("%s: Tab view model is nil", type: .error, className)
9494
return
9595
}
9696

@@ -117,12 +117,12 @@ class BrowserTabViewController: NSViewController {
117117

118118
private func displayErrorView(_ shown: Bool) {
119119
guard let webView = webView else {
120-
os_log("BrowserTabViewController: Web view is nil", log: OSLog.Category.general, type: .error)
120+
os_log("BrowserTabViewController: Web view is nil", type: .error)
121121
return
122122
}
123123

124124
guard let tabViewModel = tabViewModel else {
125-
os_log("%s: Tab view model is nil", log: OSLog.Category.general, type: .error, className)
125+
os_log("%s: Tab view model is nil", type: .error, className)
126126
return
127127
}
128128

@@ -182,7 +182,7 @@ extension BrowserTabViewController: WKNavigationDelegate {
182182

183183
tabCollectionViewModel.appendNewTabAfterSelected()
184184
guard let selectedViewModel = tabCollectionViewModel.selectedTabViewModel else {
185-
os_log("%s: Selected tab view model is nil", log: OSLog.Category.general, type: .error, className)
185+
os_log("%s: Selected tab view model is nil", type: .error, className)
186186
return nil
187187
}
188188
selectedViewModel.tab.webView.load(navigationAction.request)

DuckDuckGo/BrowserTab/View/WebView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class WebView: WKWebView {
4242

4343
private func editLinkMenu(_ menu: NSMenu) {
4444
guard let newWindowMenuItem = menu.items.first(where: { $0.identifier?.rawValue == "WKMenuItemIdentifierOpenLinkInNewWindow"}) else {
45-
os_log("WebView: WKMenuItemIdentifierOpenLinkInNewWindow menu item not found", log: OSLog.Category.general, type: .error)
45+
os_log("WebView: WKMenuItemIdentifierOpenLinkInNewWindow menu item not found", type: .error)
4646
return
4747
}
4848

DuckDuckGo/BrowserTab/ViewModel/WebViewStateObserver.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ class WebViewStateObserver: NSObject {
5454
change: [NSKeyValueChangeKey: Any]?,
5555
context: UnsafeMutableRawPointer?) {
5656
guard let keyPath = keyPath else {
57-
os_log("%s: keyPath not provided", log: OSLog.Category.general, type: .error, className)
57+
os_log("%s: keyPath not provided", type: .error, className)
5858
return
5959
}
6060

6161
guard let tabViewModel = tabViewModel else {
62-
os_log("%s: TabViewModel was released from memory", log: OSLog.Category.general, type: .error, className)
62+
os_log("%s: TabViewModel was released from memory", type: .error, className)
6363
return
6464
}
6565

6666
guard let webView = webView else {
67-
os_log("%s: TabViewModel was released from memory", log: OSLog.Category.general, type: .error, className)
67+
os_log("%s: TabViewModel was released from memory", type: .error, className)
6868
return
6969
}
7070

@@ -75,7 +75,7 @@ class WebViewStateObserver: NSObject {
7575
case #keyPath(WKWebView.isLoading): tabViewModel.isLoading = webView.isLoading
7676
case #keyPath(WKWebView.title): tabViewModel.tab.title = webView.title
7777
default:
78-
os_log("%s: keyPath %s not handled", log: OSLog.Category.general, type: .error, className, keyPath)
78+
os_log("%s: keyPath %s not handled", type: .error, className, keyPath)
7979
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
8080
}
8181
}

DuckDuckGo/Common/Extensions/NSViewExtension.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension NSView {
3333

3434
func makeMeFirstResponder() {
3535
guard let window = window else {
36-
os_log("%s: Window not available", log: OSLog.Category.general, type: .error, className)
36+
os_log("%s: Window not available", type: .error, className)
3737
return
3838
}
3939

DuckDuckGo/Common/Extensions/OSLogExtension.swift

-28
This file was deleted.

DuckDuckGo/Common/Extensions/URLExtension.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension URL {
3030
searchUrl = try searchUrl.addParameter(name: DuckDuckGoParameters.search.rawValue, value: trimmedQuery)
3131
return searchUrl
3232
} catch let error {
33-
os_log("URL extension: %s", log: OSLog.Category.general, type: .error, error.localizedDescription)
33+
os_log("URL extension: %s", type: .error, error.localizedDescription)
3434
return nil
3535
}
3636
}
@@ -44,7 +44,7 @@ extension URL {
4444
return searchUrl
4545
}
4646

47-
os_log("URL extension: Making URL from %s failed", log: OSLog.Category.general, type: .error, addressBarString)
47+
os_log("URL extension: Making URL from %s failed", type: .error, addressBarString)
4848
return nil
4949
}
5050

DuckDuckGo/Main/MainViewController.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class MainViewController: NSViewController {
5757
@IBSegueAction
5858
func createTabBarViewController(coder: NSCoder, sender: Any?, segueIdentifier: String?) -> TabBarViewController? {
5959
guard let tabBarViewController = TabBarViewController(coder: coder, tabCollectionViewModel: tabCollectionViewModel) else {
60-
os_log("MainViewController: Failed to init TabBarViewController", log: OSLog.Category.general, type: .error)
60+
os_log("MainViewController: Failed to init TabBarViewController", type: .error)
6161
return nil
6262
}
6363

@@ -68,7 +68,7 @@ class MainViewController: NSViewController {
6868
@IBSegueAction
6969
func createNavigationBarViewController(coder: NSCoder, sender: Any?, segueIdentifier: String?) -> NavigationBarViewController? {
7070
guard let navigationBarViewController = NavigationBarViewController(coder: coder, tabCollectionViewModel: tabCollectionViewModel) else {
71-
os_log("MainViewController: Failed to init NavigationBarViewController", log: OSLog.Category.general, type: .error)
71+
os_log("MainViewController: Failed to init NavigationBarViewController", type: .error)
7272
return nil
7373
}
7474

@@ -80,7 +80,7 @@ class MainViewController: NSViewController {
8080
func createWebViewController(coder: NSCoder, sender: Any?, segueIdentifier: String?) -> BrowserTabViewController? {
8181
guard let browserTabViewController = BrowserTabViewController(coder: coder,
8282
tabCollectionViewModel: tabCollectionViewModel) else {
83-
os_log("MainViewController: Failed to init BrowserTabViewController", log: OSLog.Category.general, type: .error)
83+
os_log("MainViewController: Failed to init BrowserTabViewController", type: .error)
8484
return nil
8585
}
8686

@@ -114,11 +114,11 @@ class MainViewController: NSViewController {
114114

115115
private func updateBackMenuItem() {
116116
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
117-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
117+
os_log("MainViewController: No tab view model selected", type: .error)
118118
return
119119
}
120120
guard let mainMenu = NSApplication.shared.mainMenu, let backMenuItem = mainMenu.backMenuItem else {
121-
os_log("MainViewController: Failed to get reference to back menu item", log: OSLog.Category.general, type: .error)
121+
os_log("MainViewController: Failed to get reference to back menu item", type: .error)
122122
return
123123
}
124124

@@ -127,11 +127,11 @@ class MainViewController: NSViewController {
127127

128128
func updateForwardMenuItem() {
129129
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
130-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
130+
os_log("MainViewController: No tab view model selected", type: .error)
131131
return
132132
}
133133
guard let mainMenu = NSApplication.shared.mainMenu, let forwardMenuItem = mainMenu.forwardMenuItem else {
134-
os_log("MainViewController: Failed to get reference to back menu item", log: OSLog.Category.general, type: .error)
134+
os_log("MainViewController: Failed to get reference to back menu item", type: .error)
135135
return
136136
}
137137

@@ -140,7 +140,7 @@ class MainViewController: NSViewController {
140140

141141
func updateReopenLastClosedTabMenuItem() {
142142
guard let mainMenu = NSApplication.shared.mainMenu, let reopenLastClosedTabMenuItem = mainMenu.reopenLastClosedTabMenuItem else {
143-
os_log("MainViewController: Failed to get reference to back menu item", log: OSLog.Category.general, type: .error)
143+
os_log("MainViewController: Failed to get reference to back menu item", type: .error)
144144
return
145145
}
146146

DuckDuckGo/Main/View/MainWindowController.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class MainWindowController: NSWindowController {
7979
let closeWidget = titlebarView.subviews.first(where: { $0.className == "_NSThemeCloseWidget" }),
8080
let minimizeWidget = titlebarView.subviews.first(where: { $0.className == "_NSThemeWidget" }),
8181
let zoomWidget = titlebarView.subviews.first(where: { $0.className == "_NSThemeZoomWidget" }) else {
82-
os_log("MainWindowController: Failed to get references to window buttons", log: OSLog.Category.general, type: .error)
82+
os_log("MainWindowController: Failed to get references to window buttons", type: .error)
8383
return
8484
}
8585

@@ -105,7 +105,7 @@ class MainWindowController: NSWindowController {
105105
let closeWidget = closeWidget,
106106
let minimizeWidget = minimizeWidget,
107107
let zoomWidget = zoomWidget else {
108-
os_log("MainWindowController: No references to window buttons", log: OSLog.Category.general, type: .error)
108+
os_log("MainWindowController: No references to window buttons", type: .error)
109109
return
110110
}
111111

@@ -142,7 +142,7 @@ extension MainWindowController: NSWindowDelegate {
142142

143143
func windowDidBecomeMain(_ notification: Notification) {
144144
guard let mainViewController = contentViewController as? MainViewController else {
145-
os_log("MainWindowController: Failed to get reference to main view controller", log: OSLog.Category.general, type: .error)
145+
os_log("MainWindowController: Failed to get reference to main view controller", type: .error)
146146
return
147147
}
148148

@@ -155,7 +155,7 @@ extension MainWindowController: NSWindowDelegate {
155155

156156
func windowWillClose(_ notification: Notification) {
157157
guard let mainViewController = contentViewController as? MainViewController else {
158-
os_log("MainWindowController: Failed to get reference to main view controller", log: OSLog.Category.general, type: .error)
158+
os_log("MainWindowController: Failed to get reference to main view controller", type: .error)
159159
return
160160
}
161161

DuckDuckGo/Menus/ApplicationDockMenu.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ class ApplicationDockMenu: NSMenu {
6363

6464
@objc func menuItemAction(_ sender: Any?) {
6565
guard let menuItem = sender as? NSMenuItem else {
66-
os_log("ApplicationDockMenu: Sender is not instance of NSMenuItem", log: OSLog.Category.general, type: .error)
66+
os_log("ApplicationDockMenu: Sender is not instance of NSMenuItem", type: .error)
6767
return
6868
}
6969
guard let index = items.firstIndex(of: menuItem) else {
70-
os_log("ApplicationDockMenu: NSMenuItem not part of this menu", log: OSLog.Category.general, type: .error)
70+
os_log("ApplicationDockMenu: NSMenuItem not part of this menu", type: .error)
7171
return
7272
}
7373
applicationDockMenuDelegate?.applicationDockMenu(self, selectWindowWith: index)

DuckDuckGo/Menus/MainMenuActions.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extension MainViewController {
5151

5252
@IBAction func openLocation(_ sender: Any?) {
5353
guard let addressBarTextField = navigationBarViewController?.addressBarViewController?.addressBarTextField else {
54-
os_log("MainViewController: Cannot reference address bar text field", log: OSLog.Category.general, type: .error)
54+
os_log("MainViewController: Cannot reference address bar text field", type: .error)
5555
return
5656
}
5757
view.window?.makeFirstResponder(addressBarTextField)
@@ -65,7 +65,7 @@ extension MainViewController {
6565

6666
@IBAction func reloadPage(_ sender: Any?) {
6767
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
68-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
68+
os_log("MainViewController: No tab view model selected", type: .error)
6969
return
7070
}
7171

@@ -74,7 +74,7 @@ extension MainViewController {
7474

7575
@IBAction func stopLoading(_ sender: Any?) {
7676
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
77-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
77+
os_log("MainViewController: No tab view model selected", type: .error)
7878
return
7979
}
8080

@@ -85,7 +85,7 @@ extension MainViewController {
8585

8686
@IBAction func back(_ sender: Any?) {
8787
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
88-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
88+
os_log("MainViewController: No tab view model selected", type: .error)
8989
return
9090
}
9191

@@ -94,7 +94,7 @@ extension MainViewController {
9494

9595
@IBAction func forward(_ sender: Any?) {
9696
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
97-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
97+
os_log("MainViewController: No tab view model selected", type: .error)
9898
return
9999
}
100100

@@ -103,7 +103,7 @@ extension MainViewController {
103103

104104
@IBAction func home(_ sender: Any?) {
105105
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
106-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
106+
os_log("MainViewController: No tab view model selected", type: .error)
107107
return
108108
}
109109

@@ -118,7 +118,7 @@ extension MainViewController {
118118

119119
@IBAction func moveTabToNewWindow(_ sender: Any?) {
120120
guard let selectedTabViewModel = tabCollectionViewModel.selectedTabViewModel else {
121-
os_log("MainViewController: No tab view model selected", log: OSLog.Category.general, type: .error)
121+
os_log("MainViewController: No tab view model selected", type: .error)
122122
return
123123
}
124124

0 commit comments

Comments
 (0)