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