/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2 * Copyright (C) 2008-2016 TrinityCore * Copyright (C) 2005-2009 MaNGOS */ #include "Errors.h" #include #include namespace Trinity { void Assert(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message); *((volatile int*)NULL) = 0; exit(1); } void Assert(char const* file, int line, char const* function, char const* message, char const* format, ...) { va_list args; va_start(args, format); fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s ", file, line, function, message); vfprintf(stderr, format, args); fprintf(stderr, "\n"); fflush(stderr); va_end(args); *((volatile int*)NULL) = 0; exit(1); } void Fatal(char const* file, int line, char const* function, char const* message, ...) { va_list args; va_start(args, message); fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n ", file, line, function); vfprintf(stderr, message, args); fprintf(stderr, "\n"); fflush(stderr); std::this_thread::sleep_for(std::chrono::seconds(10)); *((volatile int*)NULL) = 0; exit(1); } void Error(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n", file, line, function, message); *((volatile int*)NULL) = 0; exit(1); } void Warning(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s WARNING:\n %s\n", file, line, function, message); } void Abort(char const* file, int line, char const* function) { fprintf(stderr, "\n%s:%i in %s ABORTED.\n", file, line, function); *((volatile int*)NULL) = 0; exit(1); } void AbortHandler(int /*sigval*/) { // nothing useful to log here, no way to pass args *((volatile int*)NULL) = 0; exit(1); } } // namespace Trinity