void fatal(const char *fmt, ...) { va_list args; char *buf; char buf2[4096]; checkday(); if (!fmt) { return; } va_start(args, fmt); vsnprintf(buf2, sizeof(buf2), fmt, args); va_end(args); buf = log_gettimestamp(); if (logfile) fprintf(logfile, "%s FATAL: %s\n", buf, buf2); if (nofork) fprintf(stderr, "%s FATAL: %s\n", buf, buf2); if (servsock >= 0) xanadu_cmd_global(NULL, "FATAL ERROR! %s", buf2); /* one of the many places this needs to be called from */ ModuleRunTimeDirCleanUp(); exit(1); }
void fatal_sockerror(const char *fmt, ...) { va_list args; char *buf; char buf2[4096]; int errno_save = ano_sockgeterr(); if (!fmt) { return; } checkday(); /* this will fix 581 */ va_start(args, fmt); vsnprintf(buf2, sizeof(buf2), fmt, args); va_end(args); buf = log_gettimestamp(); if (logfile) fprintf(logfile, "%s FATAL: %s: %s\n", buf, buf2, ano_sockstrerror(errno_save)); if (stderr) fprintf(stderr, "%s FATAL: %s: %s\n", buf, buf2, ano_sockstrerror(errno_save)); if (servsock >= 0) xanadu_cmd_global(NULL, "FATAL ERROR! %s: %s", buf2, strerror(errno_save)); /* one of the many places this needs to be called from */ ModuleRunTimeDirCleanUp(); exit(1); }
void log_perror(const char *fmt, ...) { va_list args; char *buf; int errno_save = errno; char str[BUFSIZE]; checkday(); if (!fmt) { return; } va_start(args, fmt); vsnprintf(str, sizeof(str), fmt, args); va_end(args); buf = log_gettimestamp(); if (logfile) { fprintf(logfile, "%s %s : %s\n", buf, str, strerror(errno_save)); } if (nofork) { fprintf(stderr, "%s %s : %s\n", buf, str, strerror(errno_save)); } errno = errno_save; }
void alog(const char *fmt, ...) { va_list args; char *buf; int errno_save = errno; char str[BUFSIZE]; checkday(); if (!fmt) { return; } va_start(args, fmt); vsnprintf(str, sizeof(str), fmt, args); va_end(args); buf = log_gettimestamp(); if (logfile) { fprintf(logfile, "%s %s\n", buf, str); } if (nofork) { fprintf(stderr, "%s %s\n", buf, str); } if (LogChannel && logchan && !debug && findchan(LogChannel)) { privmsg(s_GlobalNoticer, LogChannel, "%s", str); } errno = errno_save; }
void fatal_perror(const char *fmt, ...) { va_list args; char *buf, buf2[4096]; int errno_save = errno; #ifdef _WIN32 char errbuf[256]; #else char *errbuf; #endif #ifdef _WIN32 strerror_s(errbuf, sizeof(errbuf), errno_save); #else errbuf = strerror(errno_save); #endif checkday(); buf = log_gettimestamp(); va_start(args, fmt); ircvsnprintf(buf2, sizeof(buf2), fmt, args); va_end(args); if (!NoLogs && logfile) fprintf(logfile, "%sFATAL: %s: %s\n", buf, buf2, errbuf); if (stderr) fprintf(stderr, "%sFATAL: %s: %s\n", buf, buf2, errbuf); if (servsock >= 0) denora_cmd_global(NULL, langstring(GLOBAL_FATAL_ERROR), buf2, errbuf); exit(1); }
void alog(int type, const char *fmt, ...) { va_list args; int errno_save = errno; char str[BUFSIZE]; char *buf; *str = '\0'; if (!fmt) { return; } if ((type == LOG_DEBUG || type == LOG_EXTRADEBUG || type == LOG_NONEXISTANT) && !denora->debug) { return; } if ((type == LOG_PROTOCOL) && !denora->protocoldebug) { return; } if (type == LOG_SQLDEBUG && !denora->sqldebug) { return; } if (LOG_EXTRADEBUG == type && denora->debug <= 1) { return; } if ((type == LOG_DEBUGSOCK || type == LOG_ADNS) && !denora->socketdebug) { return; } checkday(); va_start(args, fmt); ircvsnprintf(str, sizeof(str), fmt, args); va_end(args); buf = log_gettimestamp(); if (!NoLogs && logfile) { fprintf(logfile, "%s %s\n", buf, str); } if (denora->nofork) { fprintf(stderr, "%s %s\n", buf, str); } if (!BadPtr(LogChannel) && denora->debug < 2 && findchan(LogChannel)) { if (type == LOG_NORMAL || type == LOG_NONEXISTANT || type == LOG_ERROR) { privmsg(s_StatServ, LogChannel, "%s", str); } } errno = errno_save; }
void log_perror(const char *fmt, ...) { va_list args; int errno_save = errno; char str[BUFSIZE]; char *buf; #ifdef _WIN32 char errbuf[256]; #else char *errbuf; #endif #ifdef _WIN32 strerror_s(errbuf, sizeof(errbuf), errno_save); #else errbuf = strerror(errno_save); #endif checkday(); if (!fmt) { return; } buf = log_gettimestamp(); va_start(args, fmt); ircvsnprintf(str, sizeof(str), fmt, args); va_end(args); if (!NoLogs && logfile) { fprintf(logfile, "%s %s : %s\n", buf, str, errbuf); } if (denora->nofork) { fprintf(stderr, "%s %s : %s\n", buf, str, errbuf); } errno = errno_save; }