From 93255e0305a673344ff85f37a03c615b21dcf1b4 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 25 Oct 2004 04:51:54 +0000 Subject: [PATCH] tune down some of the logging --- src/daap.c | 30 ++++++++++++------------------ src/mDNSPosix.c | 27 +++++++++++++++------------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/daap.c b/src/daap.c index 472ce542..cb2107e5 100644 --- a/src/daap.c +++ b/src/daap.c @@ -418,14 +418,11 @@ DAAP_BLOCK *daap_response_songlist(char* metaStr, char* query) { else meta = encodeMetaRequest(metaStr, gSongMetaDataMap); - if(0 != query) - { + if(0 != query) { filter = query_build(query, song_fields); - if(err_debuglevel >= ERR_INFO) - { - fprintf(stderr, "query: %s\n", query); - query_dump(stderr, filter, 0); - } + DPRINTF(ERR_INFO,"query: %s\n", query); + if(err_debuglevel >= ERR_INFO) /* this is broken */ + query_dump(stderr,filter, 0); } DPRINTF(ERR_DEBUG,"Preparing to send db items\n"); @@ -861,14 +858,11 @@ DAAP_BLOCK *daap_response_playlist_items(unsigned int playlist, char* metaStr, c else meta = encodeMetaRequest(metaStr, gSongMetaDataMap); - if(0 != query) - { + if(0 != query) { filter = query_build(query, song_fields); - if(err_debuglevel >= ERR_INFO) - { - fprintf(stderr, "query: %s\n", query); - query_dump(stderr, filter, 0); - } + DPRINTF(ERR_INFO,"query: %s\n",query); + if(err_debuglevel >= ERR_INFO) /* this is broken */ + query_dump(stderr,filter, 0); } DPRINTF(ERR_DEBUG,"Preparing to send playlist items for pl #%d\n",playlist); @@ -1180,10 +1174,10 @@ DAAP_BLOCK* daap_response_browse(const char* name, const char* filter) 0 == (query = query_build(filter, browse_fields))) return NULL; - if(query && err_debuglevel >= ERR_INFO) - { - fprintf(stderr, "query: %s\n", query); - query_dump(stderr, query, 0); + if(query) { + DPRINTF(ERR_INFO,"query: %s\n",query); + if(err_debuglevel >= ERR_INFO) /* this is broken */ + query_dump(stderr,filter, 0); } if(0 == (henum = db_enum_begin())) diff --git a/src/mDNSPosix.c b/src/mDNSPosix.c index c0355ad1..8a8cce2c 100644 --- a/src/mDNSPosix.c +++ b/src/mDNSPosix.c @@ -36,6 +36,9 @@ Change History (most recent first): $Log$ +Revision 1.2 2004/10/25 04:51:54 rpedde +tune down some of the logging + Revision 1.1 2004/03/29 17:55:17 rpedde Flatten mdns stuff @@ -140,6 +143,7 @@ First checkin #include #include +#include "err.h" #include "mDNSUNP.h" // *************************************************************************** @@ -184,9 +188,8 @@ mDNSexport void debugf_(const char *format, ...) va_start(ptr,format); buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; va_end(ptr); - if (gMDNSPlatformPosixVerboseLevel >= 1) - fprintf(stderr, "%s\n", buffer); - fflush(stderr); + + DPRINTF(ERR_DEBUG-1,"%s\n",buffer); } mDNSexport void verbosedebugf_(const char *format, ...) @@ -196,9 +199,7 @@ mDNSexport void verbosedebugf_(const char *format, ...) va_start(ptr,format); buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; va_end(ptr); - if (gMDNSPlatformPosixVerboseLevel >= 2) - fprintf(stderr, "%s\n", buffer); - fflush(stderr); + DPRINTF(ERR_DEBUG,"%s\n",buffer); } mDNSexport void LogMsg(const char *format, ...) @@ -208,8 +209,7 @@ mDNSexport void LogMsg(const char *format, ...) va_start(ptr,format); buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; va_end(ptr); - fprintf(stderr, "%s\n", buffer); - fflush(stderr); + DPRINTF(ERR_WARN,"%s\n",buffer); } #define PosixErrorToStatus(errNum) ((errNum) == 0 ? mStatus_NoError : mStatus_UnknownErr) @@ -379,7 +379,7 @@ static void SocketDataReady(mDNS *const m, PosixNetworkInterface *intf, int skt) num_pkts_rejected++; if (num_pkts_rejected > (num_pkts_accepted + 1) * (num_registered_interfaces + 1) * 2) { - fprintf(stderr, + DPRINTF(ERR_LOG, "*** WARNING: Received %d packets; Accepted %d packets; Rejected %d packets because of interface mismatch\n", num_pkts_accepted + num_pkts_rejected, num_pkts_accepted, num_pkts_rejected); num_pkts_accepted = 0; @@ -462,7 +462,7 @@ static void ClearInterfaceList(mDNS *const m) { PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); mDNS_DeregisterInterface(m, &intf->coreIntf); - if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); + if (gMDNSPlatformPosixVerboseLevel > 0) DPRINTF(ERR_LOG, "Deregistered interface %s\n", intf->intfName); FreePosixNetworkInterface(intf); } num_registered_interfaces = 0; @@ -573,7 +573,10 @@ static int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interface bindAddr.sin_port = port.NotAnInteger; bindAddr.sin_addr.s_addr = INADDR_ANY; // Want to receive multicasts AND unicasts on this socket err = bind(*sktPtr, (struct sockaddr *) &bindAddr, sizeof(bindAddr)); - if (err < 0) { err = errno; perror("bind"); fflush(stderr); } + if (err < 0) { + err = errno; + DPRINTF(ERR_LOG,"bind: %s\n",strerror(errno)); + } } } // endif (intfAddr->sa_family == AF_INET) @@ -736,7 +739,7 @@ static int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, const cha num_registered_interfaces++; debugf("SetupOneInterface: %s %#a Registered", intf->intfName, &intf->coreIntf.ip); if (gMDNSPlatformPosixVerboseLevel > 0) - fprintf(stderr, "Registered interface %s\n", intf->intfName); + DPRINTF(ERR_LOG, "Registered interface %s\n", intf->intfName); } else {