diff --git a/src/channel.c b/src/channel.c index cb45ca57f..511227296 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1105,10 +1105,10 @@ void set_channel_mlock(Client *client, Channel *channel, const char *newmlock, i * int ret; * for (ret = parse_chanmode(&pm, modebuf, parabuf); ret; ret = parse_chanmode(&pm, NULL, NULL)) * { - * ircd_log(LOG_ERROR, "Got %c%c %s", - * pm.what == MODE_ADD ? '+' : '-', - * pm.modechar, - * pm.param ? pm.param : ""); + * unreal_log(ULOG_INFO, "test", "TEST", "Got %c%c %s", + * pm.what == MODE_ADD ? '+' : '-', + * pm.modechar, + * pm.param ? pm.param : ""); * } * @endcode */ diff --git a/src/send.c b/src/send.c index 153c2e764..44b673f26 100644 --- a/src/send.c +++ b/src/send.c @@ -284,14 +284,17 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) p = strchr(msg+1, ' '); if (!p) { - ircd_log(LOG_ERROR, "[BUG] sendbufto_one(): Malformed message: %s", - msg); + unreal_log(ULOG_WARNING, "send", "SENDBUFTO_ONE_MALFORMED_MSG", to, + "Malformed message to $client: $buf", + log_data_string("buf", msg)); return; } if (p - msg > 4094) { - ircd_log(LOG_ERROR, "[BUG] sendbufto_one(): Oversized message-tag (len %d)", - (int)(p - msg)); + unreal_log(ULOG_WARNING, "send", "SENDBUFTO_ONE_OVERSIZED_MSG", to, + "Oversized message to $client (length $length): $buf", + log_data_integer("length", p - msg), + log_data_string("buf", msg)); return; } p++; /* skip space character */ @@ -312,7 +315,10 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) if (len >= 10240) { - ircd_log(LOG_ERROR, "sendbufto_one: len=%d, quick=%u", len, quick); + unreal_log(ULOG_WARNING, "send", "SENDBUFTO_ONE_OVERSIZED_MSG2", to, + "Oversized message to $client (length $length): $buf", + log_data_integer("length", len), + log_data_string("buf", msg)); #ifdef DEBUGMODE abort(); #else @@ -326,9 +332,9 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick) p = strchr(msg, '\r'); if (p) *p = '\0'; - snprintf(tmp_msg, 500, "Trying to send data to myself! '%s'", msg); - ircd_log(LOG_ERROR, "%s", tmp_msg); - sendto_ops("%s", tmp_msg); /* recursion? */ + unreal_log(ULOG_WARNING, "send", "SENDBUFTO_ONE_ME_MESSAGE", to, + "Trying to send data to myself: $buf", + log_data_string("buf", tmp_msg)); return; } diff --git a/src/support.c b/src/support.c index 47d3cb144..3b701d43a 100644 --- a/src/support.c +++ b/src/support.c @@ -50,9 +50,7 @@ char *my_itoa(int i) * @section Ex1 Example * @code * for (name = strtoken(&p, buf, ","); name; name = strtoken(&p, NULL, ",")) - * { - * ircd_log(LOG_ERROR, "Got: %s", name); - * } + * unreal_log(ULOG_INFO, "test", "TEST", "Got: %s", name); * @endcode */ char *strtoken(char **save, char *str, char *fs) @@ -714,11 +712,11 @@ void outofmemory(size_t bytes) if (log_attempt) { + /* This will probably fail, but we can try... */ + unreal_log(ULOG_ERROR, "main", "OUT_OF_MEMORY", NULL, + "Out of memory while trying to allocate $bytes bytes!", + log_data_integer("bytes", bytes)); log_attempt = 0; - if (bytes) - ircd_log(LOG_ERROR, "Out of memory while trying to allocate %lld bytes!", (long long)bytes); - else - ircd_log(LOG_ERROR, "Out of memory"); } exit(7); } diff --git a/src/windows/gui.c b/src/windows/gui.c index 97ac85413..338dc6f37 100644 --- a/src/windows/gui.c +++ b/src/windows/gui.c @@ -169,7 +169,8 @@ LRESULT RESubClassFunc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) int DoCloseUnreal(HWND hWnd) { - ircd_log(LOG_ERROR, "Stopping UnrealIRCd..."); + unreal_log(ULOG_INFO, "main", "UNREALIRCD_STOP", NULL, + "Terminating server (process termination requested or GUI window closed)"); loop.ircd_terminating = 1; unload_all_modules(); DestroyWindow(hWnd);