forked from premiere/premiere-libtorrent
added feature to make asserts log to a file instead of breaking the process
This commit is contained in:
parent
e07bad0686
commit
6bb24bea80
|
@ -1,3 +1,5 @@
|
|||
* added feature to make asserts log to a file instead of breaking the process
|
||||
(production asserts)
|
||||
* optimized disk I/O cache clearing
|
||||
* added feature to ask a torrent if it needs to save its resume data or not
|
||||
* added setting to ignore file modification time when loading resume files
|
||||
|
|
|
@ -34,17 +34,21 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#if !defined TORRENT_DEBUG || TORRENT_NO_ASSERTS
|
||||
#if (!defined TORRENT_DEBUG && !TORRENT_PRODUCTION_ASSERTS) || TORRENT_NO_ASSERTS
|
||||
#define TORRENT_ASSERT(a) do {} while(false)
|
||||
#else
|
||||
|
||||
#if TORRENT_PRODUCTION_ASSERTS
|
||||
extern char const* libtorrent_assert_log;
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef __GNUC__
|
||||
std::string demangle(char const* name);
|
||||
#endif
|
||||
|
||||
#if (defined __linux__ || defined __MACH__) && defined __GNUC__ && defined TORRENT_DEBUG
|
||||
#if (defined __linux__ || defined __MACH__) && defined __GNUC__
|
||||
|
||||
TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file, char const* function);
|
||||
#define TORRENT_ASSERT(x) do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__); } while (false)
|
||||
|
|
|
@ -117,11 +117,15 @@ void print_backtrace(FILE* out, char const* label) {}
|
|||
|
||||
#endif
|
||||
|
||||
#if TORRENT_PRODUCTION_ASSERTS
|
||||
char const* libtorrent_assert_log = "asserts.log";
|
||||
#endif
|
||||
|
||||
void assert_fail(char const* expr, int line, char const* file, char const* function)
|
||||
{
|
||||
|
||||
#if TORRENT_PRODUCTION_ASSERTS
|
||||
FILE* out = fopen("asserts.log", "a+");
|
||||
FILE* out = fopen(libtorrent_assert_log, "a+");
|
||||
if (out == 0) out = stderr;
|
||||
#else
|
||||
FILE* out = stderr;
|
||||
|
|
Loading…
Reference in New Issue