[vlc-devel] [PATCH 1/3] bonjour: clarify log messages and use correct levels

Marvin Scholz epirat07 at gmail.com
Tue Jul 25 21:16:01 CEST 2017


Nearly all messages had level Info, which is unnecessary.
---
 modules/services_discovery/bonjour.m | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/services_discovery/bonjour.m b/modules/services_discovery/bonjour.m
index 6f7261e5d6..f8f4388689 100644
--- a/modules/services_discovery/bonjour.m
+++ b/modules/services_discovery/bonjour.m
@@ -177,23 +177,21 @@ - (void)startDiscovery
 
     msg_Info(_p_this, "starting discovery");
     for (NSDictionary *protocol in VLCSupportedProtocols) {
-        msg_Info(_p_this, "looking up %s", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
-
         /* Only discover services if we actually have a module that can handle those */
         if (!module_exists([[protocol objectForKey: VLCBonjourProtocolName] UTF8String]) && !_isRendererDiscovery) {
-            msg_Info(_p_this, "no module for %s, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
+            msg_Dbg(_p_this, "no module for %s, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
             continue;
         }
 
         /* Only discover hosts it they match the current mode (renderer or service) */
         if ([[protocol objectForKey: VLCBonjourIsRenderer] boolValue] != _isRendererDiscovery) {
-            msg_Info(_p_this, "%s does not match current discovery mode, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
+            msg_Dbg(_p_this, "%s does not match current discovery mode, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
             continue;
         }
 
         NSNetServiceBrowser *serviceBrowser = [[NSNetServiceBrowser alloc] init];
         [serviceBrowser setDelegate:self];
-        msg_Info(_p_this, "starting discovery for type %s", [[protocol objectForKey: VLCBonjourProtocolServiceName] UTF8String]);
+        msg_Dbg(_p_this, "starting discovery for type %s", [[protocol objectForKey: VLCBonjourProtocolServiceName] UTF8String]);
         [serviceBrowser searchForServicesOfType:[protocol objectForKey: VLCBonjourProtocolServiceName] inDomain:@"local."];
         [discoverers addObject:serviceBrowser];
         [protocols addObject:protocol];
@@ -229,8 +227,7 @@ - (void)stopDiscovery
 
 - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing
 {
-    msg_Info(_p_this, "found something, looking up");
-    msg_Dbg(self.p_this, "found bonjour service: %s (%s)", [aNetService.name UTF8String], [aNetService.type UTF8String]);
+    msg_Dbg(_p_this, "service found: %s (%s), resolving", [aNetService.name UTF8String], [aNetService.type UTF8String]);
     [_rawNetServices addObject:aNetService];
     aNetService.delegate = self;
     [aNetService resolveWithTimeout:5.];
@@ -238,7 +235,7 @@ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindServi
 
 - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveService:(NSNetService *)aNetService moreComing:(BOOL)moreComing
 {
-    msg_Dbg(self.p_this, "bonjour service disappeared: %s", [aNetService.name UTF8String]);
+    msg_Dbg(self.p_this, "service disappeared: %s (%s), removing", [aNetService.name UTF8String], [aNetService.type UTF8String]);
 
     /* If the item was not looked-up yet, just remove it */
     if ([_rawNetServices containsObject:aNetService])
@@ -266,7 +263,7 @@ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveSer
 
 - (void)netServiceDidResolveAddress:(NSNetService *)aNetService
 {
-    msg_Info(_p_this, "resolved something");
+    msg_Dbg(_p_this, "service resolved: %s", [aNetService.name UTF8String]);
     if (![_resolvedNetServices containsObject:aNetService]) {
         NSString *serviceType = aNetService.type;
         NSString *protocol = nil;
@@ -288,7 +285,7 @@ - (void)netServiceDidResolveAddress:(NSNetService *)aNetService
 
 - (void)netService:(NSNetService *)aNetService didNotResolve:(NSDictionary *)errorDict
 {
-    msg_Dbg(_p_this, "failed to resolve: %s", [aNetService.name UTF8String]);
+    msg_Warn(_p_this, "service resolution failed: %s, removing", [aNetService.name UTF8String]);
     [_rawNetServices removeObject:aNetService];
 }
 
-- 
2.11.0 (Apple Git-81)



More information about the vlc-devel mailing list