/** * @file llerror.h * @brief Constants, functions, and macros for logging and runtime errors. * * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. * $License$ */ #ifndef LL_LLERROR_H #define LL_LLERROR_H #include #include #include #include "llerrorstream.h" #include "llerrorbuffer.h" // Specific error codes const S32 LL_ERR_NOERR = 0; const S32 LL_ERR_ASSET_REQUEST_FAILED = -1; //const S32 LL_ERR_ASSET_REQUEST_INVALID = -2; const S32 LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3; const S32 LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4; const S32 LL_ERR_INSUFFICIENT_PERMISSIONS = -5; const S32 LL_ERR_EOF = -39; const S32 LL_ERR_CANNOT_OPEN_FILE = -42; const S32 LL_ERR_FILE_NOT_FOUND = -43; const S32 LL_ERR_FILE_EMPTY = -44; const S32 LL_ERR_TCP_TIMEOUT = -23016; const S32 LL_ERR_CIRCUIT_GONE = -23017; // Error types #define LLERR_IMAGE (1 << 1) // Image requests #define LLERR_MESSAGE (1 << 2) // Messaging #define LLERR_PERF (1 << 3) // Performance #define LLERR_SQL (1 << 4) // SQL statements #define LLERR_DOUG (1 << 5) // Doug's debugging #define LLERR_USER_INPUT (1 << 6) // Keyboard and mouse #define LLERR_TIMING (1 << 7) // Verbose time info #define LLERR_TASK (1 << 8) // Tracking tasks #define LLERR_MSG_HANDLER (1 << 9) // #define LLERR_CIRCUIT_INFO (1 << 10) // Message system circuit info #define LLERR_PHYSICS (1 << 11) // physics #define LLERR_VFS (1 << 12) // VFS const U32 LLERR_ALL = 0xffff; const U32 LLERR_NONE = 0x0; // Define one of these for different error levels in release... // #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output. #define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output #define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output. ////////////////////////////////////////// // // Implementation - ignore // // #ifdef _DEBUG #define SHOW_DEBUG #define SHOW_WARN #define SHOW_INFO #define SHOW_ASSERT #else // _DEBUG #ifdef RELEASE_SHOW_DEBUG #define SHOW_DEBUG #endif #ifdef RELEASE_SHOW_WARN #define SHOW_WARN #endif #ifdef RELEASE_SHOW_INFO #define SHOW_INFO #endif #ifdef RELEASE_SHOW_ASSERT #define SHOW_ASSERT #endif #endif // _DEBUG extern LLErrorStream gErrorStream; // LL Error macros // // Usage: // // llerrs << "An error, oh my!" << variable << endl; // llwarns << "Another error, fuck me!" << variable << endl; // llwarnst(LLERR_IMAGE) << "Debug, mother fucker" << endl; // // NOTE: The output format of filename(lineno): is so that MS DevStudio // can parse the output and automatically jump to that location inline std::string llerrno_string(int errnum) { std::stringstream res; res << "error(" << errnum << "):" << strerror(errnum) << " "; return res.str(); } inline std::string llerror_file_line(const char* file, S32 line) { std::stringstream res; res << file << "(" <