if (a->allocated < alloc) {
#if DEBUG_ARRAY
- Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
+ LogDebug("array_alloc(): changing size from %u to %u bytes.",
a->allocated, alloc);
#endif
tmp = realloc(a->mem, alloc);
assert(ptr != NULL);
#if DEBUG_ARRAY
- Log(LOG_DEBUG,
+ LogDebug(
"array_catb(): appending %u bytes to array (now %u bytes in array).",
len, tmp);
#endif
{
assert(a != NULL);
#if DEBUG_ARRAY
- Log(LOG_DEBUG,
+ LogDebug(
"array_free(): %u bytes free'd (%u bytes still used at time of free()).",
a->allocated, a->used);
#endif
return; /* nothing to do */
#if DEBUG_ARRAY
- Log(LOG_DEBUG,
+ LogDebug(
"array_moveleft(): %u bytes used in array, starting at position %u.",
a->used, bytepos);
#endif
for (n = 0; n < conf_chan->modes_num; n++) {
Req.argc = 1;
strlcpy(modes, conf_chan->modes[n], sizeof(modes));
- Log(LOG_DEBUG, "Evaluate \"MODE %s %s\".", name, modes);
+ LogDebug("Evaluate \"MODE %s %s\".", name, modes);
c = strtok(modes, " ");
while (c && Req.argc < 15) {
Req.argv[Req.argc++] = c;
slot = Last_Whowas + 1;
if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
-#ifdef DEBUG
- Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
-#endif
+ LogDebug( "Saving WHOWAS information to slot %d ...", slot );
My_Whowas[slot].time = now;
strlcpy( My_Whowas[slot].id, Client_ID( Client ),
{
CLIENT *c;
- Log(LOG_DEBUG, "Client status:");
+ LogDebug("Client status:");
c = My_Clients;
while (c) {
- Log(LOG_DEBUG,
+ LogDebug(
" - %s: type=%d, host=%s, user=%s, conn=%d, start=%ld, flags=%s",
Client_ID(c), Client_Type(c), Client_Hostname(c),
Client_User(c), Client_Conn(c), Client_StartTime(c),
if( Conf_Server[i].conn_id == Conf_Server[n].conn_id ) {
Init_Server_Struct( &Conf_Server[n] );
-#ifdef DEBUG
- Log(LOG_DEBUG,"Deleted unused duplicate server %d (kept %d).",
- n, i );
-#endif
+ LogDebug("Deleted unused duplicate server %d (kept %d).", n, i);
}
}
} else {
/* Mark server as "once" */
Conf_Server[i].flags |= CONF_SFLAG_ONCE;
- Log( LOG_DEBUG, "Marked server %d as \"once\"", i );
+ LogDebug("Marked server %d as \"once\"", i);
}
}
}
servers_once++;
}
}
- Log(LOG_DEBUG,
- "Configuration: Operators=%ld, Servers=%d[%d], Channels=%ld",
+ LogDebug("Configuration: Operators=%ld, Servers=%d[%d], Channels=%ld",
array_length(&Conf_Opers, sizeof(struct Conf_Oper)),
servers, servers_once,
array_length(&Conf_Channels, sizeof(struct Conf_Channel)));
{
int i;
- Log(LOG_DEBUG, "Configured servers:");
+ LogDebug("Configured servers:");
for (i = 0; i < MAX_SERVERS; i++) {
if (! Conf_Server[i].name[0])
continue;
- Log(LOG_DEBUG,
+ LogDebug(
" - %s: %s:%d, last=%ld, group=%d, flags=%d, conn=%d",
Conf_Server[i].name, Conf_Server[i].host,
Conf_Server[i].port, Conf_Server[i].lasttry,
#include <assert.h>
#include <time.h>
-#ifdef DEBUG
-# include "log.h"
-#endif
+#include "log.h"
#include "conn.h"
-
#include "conf.h"
#include "conn-func.h"
My_Connections[Idx].delaytime += Seconds;
-#ifdef DEBUG
- Log(LOG_DEBUG,
- "Add penalty time on connection %d: %ld second%s, total %ld second%s.",
+ LogDebug("Add penalty time on connection %d: %ld second%s, total %ld second%s.",
Idx, (long)Seconds, Seconds != 1 ? "s" : "",
My_Connections[Idx].delaytime - t,
My_Connections[Idx].delaytime - t != 1 ? "s" : "");
-#endif
} /* Conn_SetPenalty */
GLOBAL void
out->avail_out = (uInt)sizeof zipbuf;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
+ LogDebug("out->avail_in %d, out->avail_out %d",
out->avail_in, out->avail_out);
#endif
result = deflate( out, Z_SYNC_FLUSH );
zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
+ LogDebug("zipbuf_used: %d", zipbuf_used);
#endif
if (!array_catb(&My_Connections[Idx].wbuf,
(char *)zipbuf, (size_t) zipbuf_used)) {
in->avail_out = (uInt)sizeof unzipbuf;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
+ LogDebug("in->avail_in %d, in->avail_out %d",
in->avail_in, in->avail_out);
#endif
result = inflate( in, Z_SYNC_FLUSH );
in_len = z_rdatalen - in->avail_in;
unzipbuf_used = READBUFFER_LEN - in->avail_out;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
+ LogDebug("unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
in->avail_out, unzipbuf_used);
#endif
assert(unzipbuf_used <= READBUFFER_LEN);
#ifdef SNIFFER
if (NGIRCd_Sniffer)
- Log(LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer);
+ LogDebug("-> connection %d: '%s'.", Idx, buffer);
#endif
len = strlcat( buffer, "\r\n", sizeof( buffer ));
{
int i;
- Log(LOG_DEBUG, "Connection status:");
+ LogDebug("Connection status:");
for (i = 0; i < Pool_Size; i++) {
if (My_Connections[i].sock == NONE)
continue;
- Log(LOG_DEBUG,
+ LogDebug(
" - %d: host=%s, lastdata=%ld, lastping=%ld, delaytime=%ld, flag=%d, options=%d, bps=%d, client=%s",
My_Connections[i].sock, My_Connections[i].host,
My_Connections[i].lastdata, My_Connections[i].lastping,
static void
io_debug(const char *s, int fd, int what)
{
- Log(LOG_DEBUG, "%s: %d, %d\n", s, fd, what);
+ LogDebug("%s: %d, %d\n", s, fd, what);
}
#else
static inline void
return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->prefix);
- Log(LOG_DEBUG, "Connection %d: got PING, sending PONG ...",
+ LogDebug("Connection %d: got PING, sending PONG ...",
Client_Conn(Client));
#ifdef STRICT_RFC
(long)(time(NULL) - Conn_GetSignon(conn)),
time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s",
Client_UserCount(), Channel_CountVisible(NULL));
- }
-#ifdef DEBUG
- else {
+ } else {
if (Conn_LastPing(conn) > 1)
LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
conn, (long)(time(NULL) - Conn_LastPing(conn)));
LogDebug("Got unexpected PONG on connection %d. Ignored.",
conn);
}
-#endif
/* We got a PONG, so signal that none is pending on this connection. */
Conn_UpdatePing(conn, 1);
break;
default:
if (Client_Type(Client) != CLIENT_SERVER) {
- Log(LOG_DEBUG,
+ LogDebug(
"Unknown mode \"%c%c\" from \"%s\"!?",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin));
*mode_ptr);
x[0] = '\0';
} else {
- Log(LOG_DEBUG,
+ LogDebug(
"Handling unknown mode \"%c%c\" from \"%s\" for \"%s\" ...",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Client_ID(Target));
break;
default:
if (Client_Type(Client) != CLIENT_SERVER) {
- Log(LOG_DEBUG,
+ LogDebug(
"Unknown mode \"%c%c\" from \"%s\" on %s!?",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Channel_Name(Channel));
Channel_Name(Channel));
x[0] = '\0';
} else {
- Log(LOG_DEBUG,
+ LogDebug(
"Handling unknown mode \"%c%c\" from \"%s\" on %s ...",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Channel_Name(Channel));
"Failed to join client \"%s\" to channel \"%s\" (NJOIN): killing it!",
ptr, channame);
IRC_KillClient(NULL, NULL, ptr, "Internal NJOIN error!");
- Log(LOG_DEBUG, "... done.");
+ LogDebug("... done.");
goto skip_njoin;
}
/* Pidfile configured? */
if( ! Conf_PidFile[0] ) return;
-#ifdef DEBUG
- Log( LOG_DEBUG, "Removing PID file (%s) ...", Conf_PidFile );
-#endif
+ LogDebug( "Removing PID file (%s) ...", Conf_PidFile );
if( unlink( Conf_PidFile ))
Log( LOG_ERR, "Error unlinking PID file (%s): %s", Conf_PidFile, strerror( errno ));
/* Pidfile configured? */
if( ! Conf_PidFile[0] ) return;
-#ifdef DEBUG
- Log( LOG_DEBUG, "Creating PID file (%s) ...", Conf_PidFile );
-#endif
+ LogDebug( "Creating PID file (%s) ...", Conf_PidFile );
pidfd = open( Conf_PidFile, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if ( pidfd < 0 ) {
if (pwd) {
if (chdir(pwd->pw_dir) == 0)
- Log(LOG_DEBUG,
+ LogDebug(
"Changed working directory to \"%s\" ...",
pwd->pw_dir);
else
assert( Request != NULL );
#ifdef SNIFFER
- if( NGIRCd_Sniffer ) Log( LOG_DEBUG, " <- connection %d: '%s'.", Idx, Request );
+ if( NGIRCd_Sniffer ) LogDebug( " <- connection %d: '%s'.", Idx, Request );
#endif
Init_Request( &req );
static void
Dump_State(void)
{
- Log(LOG_DEBUG, "--- Internal server state: %s ---",
+ LogDebug("--- Internal server state: %s ---",
Client_ID(Client_ThisServer()));
#ifdef HAVE_LONG_LONG
- Log(LOG_DEBUG, "time()=%llu", (unsigned long long)time(NULL));
+ LogDebug("time()=%llu", (unsigned long long)time(NULL));
#else
- Log(LOG_DEBUG, "time()=%lu", (unsigned long)time(NULL));
+ LogDebug("time()=%lu", (unsigned long)time(NULL));
#endif
Conf_DebugDump();
Conn_DebugDump();
Client_DebugDump();
- Log(LOG_DEBUG, "--- End of state dump ---");
+ LogDebug("--- End of state dump ---");
} /* Dump_State */
#endif
}
break;
default:
- Log(LOG_DEBUG, "Got signal %d! Ignored.", Signal);
+ LogDebug("Got signal %d! Ignored.", Signal);
#endif
}
Signal_Unblock(Signal);