[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Migrate a few more files to domained logging
Update of /home/or/cvsroot/tor/src/tools
In directory moria:/tmp/cvs-serv9530/src/tools
Modified Files:
tor-resolve.c
Log Message:
Migrate a few more files to domained logging
Index: tor-resolve.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/tools/tor-resolve.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- tor-resolve.c 18 Oct 2005 21:58:19 -0000 1.20
+++ tor-resolve.c 18 Oct 2005 22:21:29 -0000 1.21
@@ -4,7 +4,6 @@
#include "orconfig.h"
-#define OLD_LOG_INTERFACE
#include "../common/compat.h"
#include "../common/util.h"
#include "../common/log.h"
@@ -41,8 +40,8 @@
#endif
#define RESPONSE_LEN 8
-#define log_sock_error(act, _s) \
- do { log_fn(LOG_ERR, "Error while %s: %s", act, \
+#define log_sock_error(act, _s) \
+ do { log_fn(LOG_ERR, LD_NET, "Error while %s: %s", act, \
tor_socket_strerror(tor_socket_errno(_s))); } while (0)
/** Set *<b>out</b> to a newly allocated SOCKS4a resolve request with
@@ -83,20 +82,20 @@
tor_assert(addr_out);
if (len < RESPONSE_LEN) {
- log_fn(LOG_WARN,"Truncated socks response.");
+ warn(LD_PROTOCOL,"Truncated socks response.");
return -1;
}
if (((uint8_t)response[0])!=0) { /* version: 0 */
- log_fn(LOG_WARN,"Nonzero version in socks response: bad format.");
+ warn(LD_PROTOCOL,"Nonzero version in socks response: bad format.");
return -1;
}
status = (uint8_t)response[1];
if (get_uint16(response+2)!=0) { /* port: 0 */
- log_fn(LOG_WARN,"Nonzero port in socks response: bad format.");
+ warn(LD_PROTOCOL,"Nonzero port in socks response: bad format.");
return -1;
}
if (status != 90) {
- log_fn(LOG_WARN,"Got status response '%d': socks request failed.", status);
+ warn(LD_NET,"Got status response '%d': socks request failed.", status);
return -1;
}
@@ -137,7 +136,7 @@
}
if ((len = build_socks4a_resolve_request(&req, "", hostname))<0) {
- log_fn(LOG_ERR, "Error generating SOCKS request");
+ err("Error generating SOCKS request");
return -1;
}
@@ -158,7 +157,7 @@
while (len < RESPONSE_LEN) {
r = recv(s, response_buf+len, RESPONSE_LEN-len, 0);
if (r==0) {
- log_fn(LOG_WARN,"EOF while reading SOCKS response");
+ warn(LD_NET,"EOF while reading SOCKS response");
return -1;
}
if (r<0) {
@@ -213,7 +212,7 @@
add_stream_log(LOG_WARN, LOG_ERR, "<stderr>", stderr);
}
if (n_args == 1) {
- log_fn(LOG_DEBUG, "defaulting to localhost:9050");
+ debug(LD_CONFIG, "defaulting to localhost:9050");
sockshost = 0x7f000001u; /* localhost */
socksport = 9050; /* 9050 */
} else if (n_args == 2) {
@@ -222,7 +221,7 @@
return 1;
}
if (socksport == 0) {
- log_fn(LOG_DEBUG, "defaulting to port 9050");
+ debug(LD_CONFIG, "defaulting to port 9050");
socksport = 9050;
}
} else {
@@ -237,7 +236,7 @@
}
if (network_init()<0) {
- log_fn(LOG_ERR,"Error initializing network; exiting.");
+ err("Error initializing network; exiting.");
return 1;
}