X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Flog.cpp;h=a695b0e72e53264dd58fa78e61c0c036cd1040e5;hb=a9883b166454c794e342ccc262ca97e0394af980;hp=699036b7d014e2de898213d314cafc8dce8b82ff;hpb=f8de7d373ff0a5d977adee1d1a464401ece60550;p=ipdf%2Fcode.git diff --git a/src/log.cpp b/src/log.cpp index 699036b..a695b0e 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -10,6 +10,9 @@ #include #include #include +#ifndef __MINGW32__ +#include +#endif #ifdef LOG_SYSLOG @@ -75,13 +78,13 @@ void LogEx(int level, const char * funct, const char * file, int line, ...) severity = "WARNING"; break; case LOG_NOTICE: - severity = "NOTICE"; + severity = "notice"; break; case LOG_INFO: - severity = "INFO"; + severity = "info"; break; default: - severity = "DEBUG"; + severity = "debug"; break; } @@ -139,3 +142,17 @@ void FatalEx(const char * funct, const char * file, int line, ...) } +/** + * Print a backtrace + */ +void Backtrace(int size) +{ + #ifndef __MINGW32__ + void * buffer[100]; + int actual_size = backtrace(buffer, size); + backtrace_symbols_fd(buffer, actual_size, fileno(stderr)); + #else + Error("Backtrace not supported by compiler"); + #endif +} +