diff options
-rw-r--r-- | indra/llcommon/llerror.cpp | 8 | ||||
-rw-r--r-- | indra/llcommon/llerror.h | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 4bf4827119..2d4898f7be 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -664,10 +664,10 @@ namespace // console log. It's generally considered bad form to spam too much // there. - // If stdin is a tty, assume the user launched from the command line and - // therefore wants to see stderr. Otherwise, assume we've been launched - // from the finder and shouldn't spam stderr. - return isatty(0); + // If stderr is a tty, assume the user launched from the command line or + // debugger and therefore wants to see stderr. Otherwise, assume we've + // been launched from the finder and shouldn't spam stderr. + return isatty(STDERR_FILENO); #else return true; #endif diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 0a78229555..9613911531 100644 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -381,8 +381,13 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; #define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, ##__VA_ARGS__) #define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, ##__VA_ARGS__) // alternative to llassert_always that prints explanatory message -#define LL_WARNS_IF(exp, ...) if (exp) LL_WARNS(##__VA_ARGS__) << "(" #exp ")" -#define LL_ERRS_IF(exp, ...) if (exp) LL_ERRS(##__VA_ARGS__) << "(" #exp ")" +// note ## token paste operator hack used above will only work in gcc following +// a comma and is completely unnecessary in VS since the comma is automatically +// suppressed +// https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html +// https://docs.microsoft.com/en-us/cpp/preprocessor/variadic-macros?view=vs-2015 +#define LL_WARNS_IF(exp, ...) if (exp) LL_WARNS(__VA_ARGS__) << "(" #exp ")" +#define LL_ERRS_IF(exp, ...) if (exp) LL_ERRS(__VA_ARGS__) << "(" #exp ")" // Only print the log message once (good for warnings or infos that would otherwise // spam the log file over and over, such as tighter loops). |