Remove newlines from logger calls.
authorJuho Vähä-Herttua <juhovh@iki.fi>
Wed, 28 Mar 2012 20:42:31 +0000 (23:42 +0300)
committerJuho Vähä-Herttua <juhovh@iki.fi>
Wed, 16 May 2012 21:33:32 +0000 (00:33 +0300)
src/lib/httpd.c
src/lib/logger.c
src/lib/raop.c
src/lib/raop_rtp.c

index 0dbc84776caf8b5383ac7e90718ff3055bcb098f..9c17e3694668a0d1ddc6c349dc94dfae9d0989a6 100644 (file)
@@ -110,7 +110,7 @@ httpd_add_connection(httpd_t *httpd, int fd, unsigned char *local, int local_len
                }
        }
        if (i == httpd->max_connections) {
-               logger_log(httpd->logger, LOGGER_INFO, "Max connections reached\n");
+               logger_log(httpd->logger, LOGGER_INFO, "Max connections reached");
                shutdown(fd, SHUT_RDWR);
                closesocket(fd);
                return;
@@ -186,7 +186,7 @@ httpd_thread(void *arg)
                        continue;
                } else if (ret == -1) {
                        /* FIXME: Error happened */
-                       logger_log(httpd->logger, LOGGER_INFO, "Error in select\n");
+                       logger_log(httpd->logger, LOGGER_INFO, "Error in select");
                        break;
                }
 
@@ -213,7 +213,7 @@ httpd_thread(void *arg)
                                continue;
                        }
 
-                       logger_log(httpd->logger, LOGGER_INFO, "Accepted client on socket %d\n", fd);
+                       logger_log(httpd->logger, LOGGER_INFO, "Accepted client on socket %d", fd);
                        local = netutils_get_address(&local_saddr, &local_len);
                        remote = netutils_get_address(&remote_saddr, &remote_len);
 
@@ -235,10 +235,10 @@ httpd_thread(void *arg)
                                assert(connection->request);
                        }
 
-                       logger_log(httpd->logger, LOGGER_DEBUG, "Receiving on socket %d\n", connection->socket_fd);
+                       logger_log(httpd->logger, LOGGER_DEBUG, "Receiving on socket %d", connection->socket_fd);
                        ret = recv(connection->socket_fd, buffer, sizeof(buffer), 0);
                        if (ret == 0) {
-                               logger_log(httpd->logger, LOGGER_INFO, "Connection closed for socket %d\n", connection->socket_fd);
+                               logger_log(httpd->logger, LOGGER_INFO, "Connection closed for socket %d", connection->socket_fd);
                                httpd_remove_connection(httpd, connection);
                                continue;
                        }
@@ -246,7 +246,7 @@ httpd_thread(void *arg)
                        /* Parse HTTP request from data read from connection */
                        http_request_add_data(connection->request, buffer, ret);
                        if (http_request_has_error(connection->request)) {
-                               logger_log(httpd->logger, LOGGER_INFO, "Error in parsing: %s\n", http_request_get_error_name(connection->request));
+                               logger_log(httpd->logger, LOGGER_INFO, "Error in parsing: %s", http_request_get_error_name(connection->request));
                                httpd_remove_connection(httpd, connection);
                                continue;
                        }
@@ -273,13 +273,13 @@ httpd_thread(void *arg)
                                                ret = send(connection->socket_fd, data+written, datalen-written, 0);
                                                if (ret == -1) {
                                                        /* FIXME: Error happened */
-                                                       logger_log(httpd->logger, LOGGER_INFO, "Error in sending data\n");
+                                                       logger_log(httpd->logger, LOGGER_INFO, "Error in sending data");
                                                        break;
                                                }
                                                written += ret;
                                        }
                                } else {
-                                       logger_log(httpd->logger, LOGGER_INFO, "Didn't get response\n");
+                                       logger_log(httpd->logger, LOGGER_INFO, "Didn't get response");
                                }
                                http_response_destroy(response);
                        }
@@ -293,11 +293,11 @@ httpd_thread(void *arg)
                if (!connection->connected) {
                        continue;
                }
-               logger_log(httpd->logger, LOGGER_INFO, "Removing connection for socket %d\n", connection->socket_fd);
+               logger_log(httpd->logger, LOGGER_INFO, "Removing connection for socket %d", connection->socket_fd);
                httpd_remove_connection(httpd, connection);
        }
 
-       logger_log(httpd->logger, LOGGER_INFO, "Exiting HTTP thread\n");
+       logger_log(httpd->logger, LOGGER_INFO, "Exiting HTTP thread");
 
        return 0;
 }
@@ -316,16 +316,16 @@ httpd_start(httpd_t *httpd, unsigned short *port)
 
        httpd->server_fd = netutils_init_socket(port, 1, 0);
        if (httpd->server_fd == -1) {
-               logger_log(httpd->logger, LOGGER_INFO, "Error initialising socket %d\n", SOCKET_GET_ERROR());
+               logger_log(httpd->logger, LOGGER_INFO, "Error initialising socket %d", SOCKET_GET_ERROR());
                MUTEX_UNLOCK(httpd->run_mutex);
                return -1;
        }
        if (listen(httpd->server_fd, 5) == -1) {
-               logger_log(httpd->logger, LOGGER_INFO, "Error listening to socket\n");
+               logger_log(httpd->logger, LOGGER_INFO, "Error listening to socket");
                MUTEX_UNLOCK(httpd->run_mutex);
                return -2;
        }
-       logger_log(httpd->logger, LOGGER_INFO, "Initialized server socket\n");
+       logger_log(httpd->logger, LOGGER_INFO, "Initialized server socket");
 
        /* Set values correctly and create new thread */
        httpd->running = 1;
index c4d88eeb11a9e3634efc96fb687213ca2c586648..fd87ef41f650e6306534b3570cf6083f2e41645e 100644 (file)
@@ -25,7 +25,7 @@ logger_init(logger_t *logger)
 {
        assert(logger);
 
-       logger->level = LOGGER_INFO;
+       logger->level = LOGGER_DEBUG;
        logger->callback = NULL;
 }
 
@@ -95,10 +95,10 @@ logger_log(logger_t *logger, int level, const char *fmt, ...)
                char *local = logger_utf8_to_local(buffer);
 
                if (local) {
-                       fprintf(stderr, "%s", local);
+                       fprintf(stderr, "%s\n", local);
                        free(local);
                } else {
-                       fprintf(stderr, "%s", buffer);
+                       fprintf(stderr, "%s\n", buffer);
                }
        }
 }
index fe57735329f95d6a9f672d4054a56a383b29312f..dbd6ea241d189e08abfc3bb28c618141b227d934 100644 (file)
@@ -85,21 +85,21 @@ conn_init(void *opaque, unsigned char *local, int locallen, unsigned char *remot
 
        if (locallen == 4) {
                logger_log(&conn->raop->logger, LOGGER_INFO,
-                          "Local: %d.%d.%d.%d\n",
+                          "Local: %d.%d.%d.%d",
                           local[0], local[1], local[2], local[3]);
        } else if (locallen == 16) {
                logger_log(&conn->raop->logger, LOGGER_INFO,
-                          "Local: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
+                          "Local: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
                           local[0], local[1], local[2], local[3], local[4], local[5], local[6], local[7],
                           local[8], local[9], local[10], local[11], local[12], local[13], local[14], local[15]);
        }
        if (remotelen == 4) {
                logger_log(&conn->raop->logger, LOGGER_INFO,
-                          "Remote: %d.%d.%d.%d\n",
+                          "Remote: %d.%d.%d.%d",
                           remote[0], remote[1], remote[2], remote[3]);
        } else if (remotelen == 16) {
                logger_log(&conn->raop->logger, LOGGER_INFO,
-                          "Remote: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
+                          "Remote: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
                           remote[0], remote[1], remote[2], remote[3], remote[4], remote[5], remote[6], remote[7],
                           remote[8], remote[9], remote[10], remote[11], remote[12], remote[13], remote[14], remote[15]);
        }
@@ -143,8 +143,8 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
 
                authorization = http_request_get_header(request, "Authorization");
                if (authorization) {
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "Our nonce: %s\n", conn->nonce);
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "Authorization: %s\n", authorization);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "Our nonce: %s", conn->nonce);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "Authorization: %s", authorization);
                }
                if (!digest_is_valid("AppleTV", raop->password, conn->nonce, method, http_request_get_url(request), authorization)) {
                        char *authstr;
@@ -167,7 +167,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                        http_response_add_header(res, "WWW-Authenticate", authstr);
                        free(authstr);
                } else {
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "AUTHENTICATION SUCCESS!\n");
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "AUTHENTICATION SUCCESS!");
                }
        }
 
@@ -183,8 +183,8 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                            conn->local, conn->locallen, raop->hwaddr, raop->hwaddrlen);
                http_response_add_header(res, "Apple-Response", signature);
 
-               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Got challenge: %s\n", challenge);
-               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Got response: %s\n", signature);
+               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Got challenge: %s", challenge);
+               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Got response: %s", signature);
        }
 
        if (require_auth) {
@@ -210,15 +210,15 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                        aeskeystr = sdp_get_rsaaeskey(sdp);
                        aesivstr = sdp_get_aesiv(sdp);
 
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "connection: %s\n", remotestr);
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "fmtp: %s\n", fmtpstr);
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "rsaaeskey: %s\n", aeskeystr);
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "aesiv: %s\n", aesivstr);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "connection: %s", remotestr);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "fmtp: %s", fmtpstr);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "rsaaeskey: %s", aeskeystr);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "aesiv: %s", aesivstr);
 
                        aeskeylen = rsakey_decrypt(raop->rsakey, aeskey, sizeof(aeskey), aeskeystr);
                        aesivlen = rsakey_parseiv(raop->rsakey, aesiv, sizeof(aesiv), aesivstr);
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "aeskeylen: %d\n", aeskeylen);
-                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "aesivlen: %d\n", aesivlen);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "aeskeylen: %d", aeskeylen);
+                       logger_log(&conn->raop->logger, LOGGER_DEBUG, "aesivlen: %d", aesivlen);
 
                        if (conn->raop_rtp) {
                                /* This should never happen */
@@ -238,7 +238,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                transport = http_request_get_header(request, "Transport");
                assert(transport);
 
-               logger_log(&conn->raop->logger, LOGGER_INFO, "Transport: %s\n", transport);
+               logger_log(&conn->raop->logger, LOGGER_INFO, "Transport: %s", transport);
                use_udp = strncmp(transport, "RTP/AVP/TCP", 11);
                if (use_udp) {
                        char *original, *current, *tmpstr;
@@ -251,12 +251,12 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
 
                                        ret = sscanf(tmpstr, "control_port=%hu", &value);
                                        if (ret == 1) {
-                                               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Found remote control port: %hu\n", value);
+                                               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Found remote control port: %hu", value);
                                                remote_cport = value;
                                        }
                                        ret = sscanf(tmpstr, "timing_port=%hu", &value);
                                        if (ret == 1) {
-                                               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Found remote timing port: %hu\n", value);
+                                               logger_log(&conn->raop->logger, LOGGER_DEBUG, "Found remote timing port: %hu", value);
                                                remote_tport = value;
                                        }
                                }
@@ -275,7 +275,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
                                 "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record;server_port=%u",
                                 dport);
                }
-               logger_log(&conn->raop->logger, LOGGER_INFO, "Responding with %s\n", buffer);
+               logger_log(&conn->raop->logger, LOGGER_INFO, "Responding with %s", buffer);
                http_response_add_header(res, "Transport", buffer);
                http_response_add_header(res, "Session", "DEADBEEF");
        } else if (!strcmp(method, "SET_PARAMETER")) {
@@ -300,7 +300,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
 
                rtpinfo = http_request_get_header(request, "RTP-Info");
                if (rtpinfo) {
-                       logger_log(&conn->raop->logger, LOGGER_INFO, "Flush with RTP-Info: %s\n", rtpinfo);
+                       logger_log(&conn->raop->logger, LOGGER_INFO, "Flush with RTP-Info: %s", rtpinfo);
                        if (!strncmp(rtpinfo, "seq=", 4)) {
                                next_seq = strtol(rtpinfo+4, NULL, 10);
                        }
@@ -319,7 +319,7 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response)
        }
        http_response_finish(res, NULL, 0);
 
-       logger_log(&conn->raop->logger, LOGGER_DEBUG, "Got request %s with URL %s\n", method, http_request_get_url(request));
+       logger_log(&conn->raop->logger, LOGGER_DEBUG, "Got request %s with URL %s", method, http_request_get_url(request));
        *response = res;
 }
 
index 7ab98dc32ca48937ec696858b0a50cb26c7bde64..3400c0c9169e65679b0ec573cb6899bf5573b2eb 100644 (file)
@@ -210,7 +210,7 @@ raop_rtp_resend_callback(void *opaque, unsigned short seqnum, unsigned short cou
        addr = (struct sockaddr *)&raop_rtp->control_saddr;
        addrlen = raop_rtp->control_saddr_len;
 
-       logger_log(raop_rtp->logger, LOGGER_DEBUG, "Got resend request %d %d\n", seqnum, count);
+       logger_log(raop_rtp->logger, LOGGER_DEBUG, "Got resend request %d %d", seqnum, count);
        ourseqnum = raop_rtp->control_seqnum++;
 
        /* Fill the request buffer */
@@ -225,7 +225,7 @@ raop_rtp_resend_callback(void *opaque, unsigned short seqnum, unsigned short cou
 
        ret = sendto(raop_rtp->csock, (const char *)packet, sizeof(packet), 0, addr, addrlen);
        if (ret == -1) {
-               logger_log(raop_rtp->logger, LOGGER_WARNING, "Resend failed: %d\n", SOCKET_GET_ERROR());
+               logger_log(raop_rtp->logger, LOGGER_WARNING, "Resend failed: %d", SOCKET_GET_ERROR());
        }
 
        return 0;
@@ -320,7 +320,7 @@ raop_rtp_thread_udp(void *arg)
                        if (packetlen >= 12) {
                                char type = packet[1] & ~0x80;
 
-                               logger_log(raop_rtp->logger, LOGGER_DEBUG, "Got control packet of type 0x%02x\n", type);
+                               logger_log(raop_rtp->logger, LOGGER_DEBUG, "Got control packet of type 0x%02x", type);
                                if (type == 0x56) {
                                        /* Handle resent data packet */
                                        int ret = raop_buffer_queue(raop_rtp->buffer, packet+4, packetlen-4, 1);
@@ -328,7 +328,7 @@ raop_rtp_thread_udp(void *arg)
                                }
                        }
                } else if (FD_ISSET(raop_rtp->tsock, &rfds)) {
-                       logger_log(raop_rtp->logger, LOGGER_INFO, "Would have timing packet in queue\n");
+                       logger_log(raop_rtp->logger, LOGGER_INFO, "Would have timing packet in queue");
                } else if (FD_ISSET(raop_rtp->dsock, &rfds)) {
                        saddrlen = sizeof(saddr);
                        packetlen = recvfrom(raop_rtp->dsock, (char *)packet, sizeof(packet), 0,
@@ -355,7 +355,7 @@ raop_rtp_thread_udp(void *arg)
                        }
                }
        }
-       logger_log(raop_rtp->logger, LOGGER_INFO, "Exiting UDP RAOP thread\n");
+       logger_log(raop_rtp->logger, LOGGER_INFO, "Exiting UDP RAOP thread");
        raop_rtp->callbacks.audio_destroy(raop_rtp->callbacks.cls, cb_data);
 
        return 0;
@@ -421,19 +421,19 @@ raop_rtp_thread_tcp(void *arg)
                        continue;
                } else if (ret == -1) {
                        /* FIXME: Error happened */
-                       logger_log(raop_rtp->logger, LOGGER_INFO, "Error in select\n");
+                       logger_log(raop_rtp->logger, LOGGER_INFO, "Error in select");
                        break;
                }
                if (stream_fd == -1 && FD_ISSET(raop_rtp->dsock, &rfds)) {
                        struct sockaddr_storage saddr;
                        socklen_t saddrlen;
 
-                       logger_log(raop_rtp->logger, LOGGER_INFO, "Accepting client\n");
+                       logger_log(raop_rtp->logger, LOGGER_INFO, "Accepting client");
                        saddrlen = sizeof(saddr);
                        stream_fd = accept(raop_rtp->dsock, (struct sockaddr *)&saddr, &saddrlen);
                        if (stream_fd == -1) {
                                /* FIXME: Error happened */
-                               logger_log(raop_rtp->logger, LOGGER_INFO, "Error in accept %d %s\n", errno, strerror(errno));
+                               logger_log(raop_rtp->logger, LOGGER_INFO, "Error in accept %d %s", errno, strerror(errno));
                                break;
                        }
                }
@@ -446,11 +446,11 @@ raop_rtp_thread_tcp(void *arg)
                        ret = recv(stream_fd, (char *)(packet+packetlen), sizeof(packet)-packetlen, 0);
                        if (ret == 0) {
                                /* TCP socket closed */
-                               logger_log(raop_rtp->logger, LOGGER_INFO, "TCP socket closed\n");
+                               logger_log(raop_rtp->logger, LOGGER_INFO, "TCP socket closed");
                                break;
                        } else if (ret == -1) {
                                /* FIXME: Error happened */
-                               logger_log(raop_rtp->logger, LOGGER_INFO, "Error in recv\n");
+                               logger_log(raop_rtp->logger, LOGGER_INFO, "Error in recv");
                                break;
                        }
                        packetlen += ret;
@@ -466,7 +466,7 @@ raop_rtp_thread_tcp(void *arg)
                        rtplen = (packet[2] << 8) | packet[3];
                        if (rtplen > sizeof(packet)) {
                                /* FIXME: Too long packet */
-                               logger_log(raop_rtp->logger, LOGGER_INFO, "Error, packet too long %d\n", rtplen);
+                               logger_log(raop_rtp->logger, LOGGER_INFO, "Error, packet too long %d", rtplen);
                                break;
                        }
                        if (packetlen < 4+rtplen) {
@@ -493,7 +493,7 @@ raop_rtp_thread_tcp(void *arg)
                closesocket(stream_fd);
        }
 
-       logger_log(raop_rtp->logger, LOGGER_INFO, "Exiting TCP RAOP thread\n");
+       logger_log(raop_rtp->logger, LOGGER_INFO, "Exiting TCP RAOP thread");
        raop_rtp->callbacks.audio_destroy(raop_rtp->callbacks.cls, cb_data);
 
        return 0;
@@ -520,7 +520,7 @@ raop_rtp_start(raop_rtp_t *raop_rtp, int use_udp, unsigned short control_rport,
                use_ipv6 = 1;
        }
        if (raop_rtp_init_sockets(raop_rtp, use_ipv6, use_udp) < 0) {
-               logger_log(raop_rtp->logger, LOGGER_INFO, "Initializing sockets failed\n");
+               logger_log(raop_rtp->logger, LOGGER_INFO, "Initializing sockets failed");
                MUTEX_UNLOCK(raop_rtp->run_mutex);
                return;
        }