Loglevel cleanups.
This commit is contained in:
parent
199c62bca8
commit
faaeb703fd
@ -785,7 +785,7 @@ void ircize(list_t *ll)
|
||||
|
||||
link = hash_get(adm_conn, c->name);
|
||||
if (!link) {
|
||||
mylog(LOG_DEBUG, "new connection: \"%s\"",
|
||||
mylog(LOG_DEBUGVERB, "new connection: \"%s\"",
|
||||
c->name);
|
||||
link = irc_link_new();
|
||||
hash_insert(adm_conn, c->name, link);
|
||||
@ -808,7 +808,7 @@ void ircize(list_t *ll)
|
||||
}
|
||||
list_add_last(ll, link);
|
||||
} else {
|
||||
mylog(LOG_DEBUG, "old connection: \"%s\"",
|
||||
mylog(LOG_DEBUGVERB, "old connection: \"%s\"",
|
||||
c->name);
|
||||
#define MAYFREE(a) do { \
|
||||
if (a) { \
|
||||
|
@ -50,7 +50,8 @@ static void connecting_data_free(struct connecting_data *t)
|
||||
|
||||
void connection_close(connection_t *cn)
|
||||
{
|
||||
mylog(LOG_DEBUG, "Connection close asked. FD:%d ", (long)cn->handle);
|
||||
mylog(LOG_DEBUGVERB, "Connection close asked. FD:%d ",
|
||||
(long)cn->handle);
|
||||
if (cn->connected != CONN_DISCONN) {
|
||||
cn->connected = CONN_DISCONN;
|
||||
shutdown(cn->handle, SHUT_RDWR);
|
||||
@ -170,7 +171,7 @@ static X509 *mySSL_get_cert(SSL *ssl)
|
||||
X509 *cert;
|
||||
|
||||
if (!ssl) {
|
||||
mylog(LOG_WARN, "mySSL_get_cert() No SSL context");
|
||||
mylog(LOG_DEBUGVERB, "mySSL_get_cert() No SSL context");
|
||||
return NULL;
|
||||
}
|
||||
cert = SSL_get_peer_certificate(ssl);
|
||||
@ -189,7 +190,8 @@ static int _write_socket_SSL(connection_t *cn, char* message)
|
||||
if (!cn->client && cn->cert == NULL) {
|
||||
cn->cert = mySSL_get_cert(cn->ssl_h);
|
||||
if (cn->cert == NULL) {
|
||||
mylog(LOG_ERROR, "No certificate in SSL write_socket");
|
||||
mylog(LOG_DEBUGVERB,
|
||||
"No certificate in SSL write_socket");
|
||||
return WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
@ -202,7 +204,8 @@ static int _write_socket_SSL(connection_t *cn, char* message)
|
||||
|| err == SSL_ERROR_WANT_ACCEPT)
|
||||
return WRITE_KEEP;
|
||||
if (cn_is_connected(cn)) {
|
||||
mylog(LOG_DEBUG, "fd %d: Connection error", cn->handle);
|
||||
mylog(LOG_DEBUGVERB, "fd %d: Connection error",
|
||||
cn->handle);
|
||||
cn->connected = CONN_ERROR;
|
||||
}
|
||||
return WRITE_ERROR;
|
||||
@ -434,7 +437,7 @@ static int read_socket(connection_t *cn)
|
||||
if (errno == EAGAIN || errno == EINTR || errno == EINPROGRESS)
|
||||
return 0;
|
||||
if (cn_is_connected(cn)) {
|
||||
mylog(LOG_DEBUG, "fd %d: Connection error",
|
||||
mylog(LOG_DEBUGVERB, "fd %d: Connection error",
|
||||
cn->handle);
|
||||
mylog(LOG_DEBUGTOOMUCH, "fd %d: read() %s", cn->handle,
|
||||
strerror(errno));
|
||||
@ -443,7 +446,8 @@ static int read_socket(connection_t *cn)
|
||||
return 1;
|
||||
} else if (count == 0) {
|
||||
if (cn_is_connected(cn)) {
|
||||
mylog(LOG_DEBUG, "fd %d: Connection lost", cn->handle);
|
||||
mylog(LOG_DEBUGVERB, "fd %d: Connection lost",
|
||||
cn->handle);
|
||||
cn->connected = CONN_DISCONN;
|
||||
mylog(LOG_DEBUGTOOMUCH, "fd %d: read() %s", cn->handle,
|
||||
strerror(errno));
|
||||
@ -628,7 +632,7 @@ static int check_event_write(fd_set *fds, connection_t *cn, int *nc)
|
||||
(void *)&err, &errSize);
|
||||
|
||||
if (err2 < 0) {
|
||||
mylog(LOG_WARN, "fd:%d getsockopt error: %s",
|
||||
mylog(LOG_DEBUGVERB, "fd:%d getsockopt error: %s",
|
||||
cn->handle, strerror(errno));
|
||||
if (cn->connecting_data)
|
||||
connect_trynext(cn);
|
||||
@ -798,7 +802,7 @@ list_t *wait_event(list_t *cn_list, int *msec, int *nc)
|
||||
tv.tv_sec = *msec / 1000;
|
||||
tv.tv_usec = (*msec % 1000) * 1000;
|
||||
gettimeofday(&btv, NULL);
|
||||
mylog(LOG_DEBUGVERB,"msec: %d, sec: %d, usec: %d", *msec, tv.tv_sec,
|
||||
mylog(LOG_DEBUGVERB, "msec: %d, sec: %d, usec: %d", *msec, tv.tv_sec,
|
||||
tv.tv_usec);
|
||||
err = select(maxfd + 1, &fds_read, &fds_write, &fds_except, &tv);
|
||||
gettimeofday(&etv, NULL);
|
||||
@ -811,7 +815,7 @@ list_t *wait_event(list_t *cn_list, int *msec, int *nc)
|
||||
/* in case we go forward in time */
|
||||
if (*msec < 0)
|
||||
*msec = 0;
|
||||
mylog(LOG_DEBUGVERB,"msec: %d, sec: %d, usec: %d", *msec, tv.tv_sec,
|
||||
mylog(LOG_DEBUGVERB, "msec: %d, sec: %d, usec: %d", *msec, tv.tv_sec,
|
||||
tv.tv_usec);
|
||||
if (err < 0) {
|
||||
if (errno == EINTR)
|
||||
@ -828,7 +832,7 @@ list_t *wait_event(list_t *cn_list, int *msec, int *nc)
|
||||
int toadd = 0;
|
||||
|
||||
if (check_event_except(&fds_except, cn)) {
|
||||
mylog(LOG_DEBUGVERB,"Notify on FD %d (state %d)",
|
||||
mylog(LOG_DEBUGVERB, "Notify on FD %d (state %d)",
|
||||
cn->handle, cn->connected);
|
||||
list_add_first(cn_newdata, cn);
|
||||
continue;
|
||||
@ -865,15 +869,13 @@ static void create_socket(char *dsthostname, char *dstport, char *srchostname,
|
||||
cn->connected = CONN_ERROR;
|
||||
cdata = (struct connecting_data *)
|
||||
malloc(sizeof(struct connecting_data));
|
||||
if (!cdata) {
|
||||
mylog(LOG_ERROR, "malloc() : %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
if (!cdata)
|
||||
fatal("Out of memory.")
|
||||
cdata->dst = cdata->src = cdata->cur = NULL;
|
||||
|
||||
err = getaddrinfo(dsthostname, dstport, &hint, &cdata->dst);
|
||||
if (err) {
|
||||
mylog(LOG_ERROR, "getaddrinfo(dst): %s", gai_strerror(err));
|
||||
mylog(LOG_DEBUG, "getaddrinfo(dst): %s", gai_strerror(err));
|
||||
connecting_data_free(cdata);
|
||||
cdata = NULL;
|
||||
return;
|
||||
@ -883,7 +885,7 @@ static void create_socket(char *dsthostname, char *dstport, char *srchostname,
|
||||
if ((err = getaddrinfo(srchostname, srcport, &hint,
|
||||
&cdata->src))) {
|
||||
/* not fatal ? maybe a config option is needed */
|
||||
mylog(LOG_WARN, "getaddrinfo(src): %s",
|
||||
mylog(LOG_DEBUG, "getaddrinfo(src): %s",
|
||||
gai_strerror(err));
|
||||
cdata->src = NULL;
|
||||
}
|
||||
@ -918,7 +920,7 @@ static void create_listening_socket(char *hostname, char *port,
|
||||
|
||||
err = getaddrinfo(hostname, port, &hint, &res);
|
||||
if (err) {
|
||||
mylog(LOG_ERROR, "getaddrinfo(): %s", gai_strerror(err));
|
||||
mylog(LOG_DEBUG, "getaddrinfo(): %s", gai_strerror(err));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1096,7 +1098,7 @@ static SSL_CTX *SSL_init_context(void)
|
||||
flags |= O_NONBLOCK;
|
||||
fd = open("/dev/random", flags);
|
||||
if (fd < 0) {
|
||||
mylog(LOG_DEBUG, "SSL: /dev/random not ready, unable "
|
||||
mylog(LOG_WARN, "SSL: /dev/random not ready, unable "
|
||||
"to manually seed PRNG.");
|
||||
goto prng_end;
|
||||
}
|
||||
@ -1130,13 +1132,12 @@ prng_end:
|
||||
|
||||
/* allocated by function */
|
||||
ctx = SSL_CTX_new(SSLv23_method());
|
||||
if (!SSL_CTX_use_certificate_chain_file(ctx,conf_ssl_certfile)) {
|
||||
if (!SSL_CTX_use_certificate_chain_file(ctx,conf_ssl_certfile))
|
||||
mylog(LOG_DEBUG, "SSL: Unable to load certificate file");
|
||||
}
|
||||
if (!SSL_CTX_use_PrivateKey_file(ctx, conf_ssl_certfile,
|
||||
SSL_FILETYPE_PEM)) {
|
||||
SSL_FILETYPE_PEM))
|
||||
mylog(LOG_DEBUG, "SSL: Unable to load key file");
|
||||
}
|
||||
|
||||
SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_BOTH);
|
||||
SSL_CTX_set_timeout(ctx,(long)60);
|
||||
SSL_CTX_set_options(ctx, SSL_OP_ALL);
|
||||
|
25
src/irc.c
25
src/irc.c
@ -298,7 +298,7 @@ static int irc_315(struct link_server *server, struct line *l)
|
||||
link->who_client->whoc_tstamp = time(NULL);
|
||||
if (link->who_client->who_count > 0) {
|
||||
--link->who_client->who_count;
|
||||
mylog(LOG_INFO,
|
||||
mylog(LOG_DEBUG,
|
||||
"RPL_ENDOFWHO: "
|
||||
"Decrementing who count for %p: %d",
|
||||
link->who_client, link->who_client->who_count);
|
||||
@ -312,7 +312,7 @@ static int irc_315(struct link_server *server, struct line *l)
|
||||
void rotate_who_client(struct link *link)
|
||||
{
|
||||
int i;
|
||||
mylog(LOG_INFO, "rotate_who_client %p", link->who_client);
|
||||
mylog(LOG_DEBUG, "rotate_who_client %p", link->who_client);
|
||||
/* find a client with non-null who_count */
|
||||
link->who_client = NULL;
|
||||
for (i = 0; i < link->l_clientc; i++) {
|
||||
@ -469,7 +469,7 @@ int irc_dispatch_server(struct link_server *server, struct line *line)
|
||||
}
|
||||
if (LINK(server)->who_client &&
|
||||
LINK(server)->who_client->who_count == 0) {
|
||||
mylog(LOG_INFO, "OK_COPY_WHO: who_count for %p is nul",
|
||||
mylog(LOG_DEBUG, "OK_COPY_WHO: who_count for %p is nul",
|
||||
LINK(server)->who_client);
|
||||
rotate_who_client(LINK(server));
|
||||
}
|
||||
@ -556,11 +556,11 @@ void unbind_from_link(struct link_client *ic)
|
||||
fatal("unbind_from_link");
|
||||
|
||||
if (l->who_client == ic) {
|
||||
mylog(LOG_INFO, "unbind_from_link: %p: %d",
|
||||
mylog(LOG_DEBUG, "unbind_from_link: %p: %d",
|
||||
l->who_client, ic->who_count);
|
||||
l->who_client = NULL;
|
||||
} else {
|
||||
mylog(LOG_INFO,
|
||||
mylog(LOG_DEBUG,
|
||||
"unbind_from_link: nothing to do %p != %p: %d",
|
||||
ic, l->who_client,
|
||||
ic->who_count);
|
||||
@ -855,7 +855,7 @@ static int irc_cli_who(struct link_client *ic, struct line *line)
|
||||
++ic->who_count;
|
||||
if (ic->who_count == 1)
|
||||
ic->whoc_tstamp = time(NULL);
|
||||
mylog(LOG_INFO, "cli_who: Incrementing who count for %p: %d",
|
||||
mylog(LOG_DEBUG, "cli_who: Incrementing who count for %p: %d",
|
||||
ic, ic->who_count);
|
||||
|
||||
if (l->who_client && l->who_client != ic) {
|
||||
@ -884,7 +884,7 @@ static int irc_cli_mode(struct link_client *ic, struct line *line)
|
||||
++ic->who_count;
|
||||
if (ic->who_count == 1)
|
||||
ic->whoc_tstamp = time(NULL);
|
||||
mylog(LOG_INFO, "cli_mode: Incrementing who count for %p: %d",
|
||||
mylog(LOG_DEBUG, "cli_mode: Incrementing who count for %p: %d",
|
||||
l->who_client, ic->who_count);
|
||||
|
||||
if (l->who_client && l->who_client != ic) {
|
||||
@ -1372,7 +1372,7 @@ static int irc_368(struct link_server *server, struct line *l)
|
||||
|
||||
if (link->who_client->who_count > 0) {
|
||||
--link->who_client->who_count;
|
||||
mylog(LOG_INFO,
|
||||
mylog(LOG_DEBUG,
|
||||
"RPL_ENDOFBANLIST: "
|
||||
"Decrementing who count for %p: %d",
|
||||
link->who_client, link->who_client->who_count);
|
||||
@ -2033,11 +2033,8 @@ void oidentd_dump(list_t *connl)
|
||||
}
|
||||
|
||||
filename = (char *)malloc(strlen(home) + strlen("/.oidentd.conf"));
|
||||
|
||||
if(filename == NULL){
|
||||
mylog(LOG_WARN, "oidentd_dump : malloc failed, returning");
|
||||
return;
|
||||
}
|
||||
if(filename == NULL)
|
||||
fatal("Out of memory.");
|
||||
|
||||
sprintf(filename, "%s/.oidentd.conf", home);
|
||||
|
||||
@ -2084,7 +2081,7 @@ void oidentd_dump(list_t *connl)
|
||||
* completely */
|
||||
fseek(f, SEEK_SET, 0);
|
||||
if (ftruncate(fileno(f), 0) == -1) {
|
||||
mylog(LOG_WARN, "Can't reset %s size",
|
||||
mylog(LOG_DEBUG, "Can't reset %s size",
|
||||
filename);
|
||||
goto clean_oidentd;
|
||||
}
|
||||
|
11
src/log.c
11
src/log.c
@ -716,7 +716,7 @@ char *log_beautify(char *buf, char *dest)
|
||||
int done;
|
||||
|
||||
if (!buf)
|
||||
mylog(LOG_DEBUG, "BUG!");
|
||||
fatal("BUG log_beautify not called correctly!");
|
||||
|
||||
p = strchr(buf, ' ');
|
||||
if (!p || !p[0] || !p[1])
|
||||
@ -908,12 +908,12 @@ next_file:
|
||||
/* check the files containing data to backlog */
|
||||
lf = list_it_item(&logdata->file_it);
|
||||
if (lf != list_get_last(&lfg->file_group)) {
|
||||
mylog(LOG_DEBUG, "%s not last file!", lf->filename);
|
||||
mylog(LOG_DEBUGVERB, "%s not last file!", lf->filename);
|
||||
/* if the file is not the current open for logging
|
||||
* (it is an old file that has been rotated)
|
||||
* open if necessary, backlog line per line, and close */
|
||||
if (!lf->file) {
|
||||
mylog(LOG_DEBUG, "opening: %s!", lf->filename);
|
||||
mylog(LOG_DEBUGVERB, "opening: %s!", lf->filename);
|
||||
lf->file = fopen(lf->filename, "r");
|
||||
if (!lf->file) {
|
||||
mylog(LOG_ERROR, "Can't open %s for reading",
|
||||
@ -923,7 +923,8 @@ next_file:
|
||||
return _log_wrap("Error reading logfile",
|
||||
destination);
|
||||
}
|
||||
mylog(LOG_DEBUG, "seeking: %d!", lf->backlog_offset);
|
||||
mylog(LOG_DEBUGVERB, "seeking: %d!",
|
||||
lf->backlog_offset);
|
||||
if (fseek(lf->file, lf->backlog_offset, SEEK_SET)) {
|
||||
log_reinit(lfg);
|
||||
free(buf);
|
||||
@ -942,7 +943,7 @@ next_file:
|
||||
if (pos == LOGLINE_MAXLEN)
|
||||
mylog(LOG_DEBUG, "logline too long");
|
||||
if (c == EOF || pos == LOGLINE_MAXLEN) {
|
||||
mylog(LOG_DEBUG, "EOF: %s (%d)!",
|
||||
mylog(LOG_DEBUGVERB, "EOF: %s (%d)!",
|
||||
lf->filename,
|
||||
conf_always_backlog);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user