mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 00:16:45 +00:00
For platforms printing to stdout/stderr, skip debug msgs & long prefix
This commit is contained in:
@@ -276,20 +276,24 @@ void rdclog_flush()
|
||||
{
|
||||
}
|
||||
|
||||
void rdclogprint_int(const char *str)
|
||||
void rdclogprint_int(LogType type, const char *fullMsg, const char *msg)
|
||||
{
|
||||
static Threading::CriticalSection lock;
|
||||
|
||||
SCOPED_LOCK(lock);
|
||||
|
||||
#if defined(OUTPUT_LOG_TO_DEBUG_OUT)
|
||||
OSUtility::WriteOutput(OSUtility::Output_DebugMon, str);
|
||||
OSUtility::WriteOutput(OSUtility::Output_DebugMon, fullMsg);
|
||||
#endif
|
||||
#if defined(OUTPUT_LOG_TO_STDOUT)
|
||||
OSUtility::WriteOutput(OSUtility::Output_StdOut, str);
|
||||
// don't output debug messages to stdout/stderr
|
||||
if(type != RDCLog_Debug)
|
||||
OSUtility::WriteOutput(OSUtility::Output_StdOut, msg);
|
||||
#endif
|
||||
#if defined(OUTPUT_LOG_TO_STDERR)
|
||||
OSUtility::WriteOutput(OSUtility::Output_StdErr, str);
|
||||
// don't output debug messages to stdout/stderr
|
||||
if(type != RDCLog_Debug)
|
||||
OSUtility::WriteOutput(OSUtility::Output_StdErr, msg);
|
||||
#endif
|
||||
#if defined(OUTPUT_LOG_TO_DISK)
|
||||
if(!logfile().empty())
|
||||
@@ -298,7 +302,7 @@ void rdclogprint_int(const char *str)
|
||||
if(f)
|
||||
{
|
||||
// strlen used as byte length - str is UTF-8 so this is NOT number of characters
|
||||
FileIO::fwrite(str, 1, strlen(str), f);
|
||||
FileIO::fwrite(fullMsg, 1, strlen(fullMsg), f);
|
||||
FileIO::fclose(f);
|
||||
}
|
||||
}
|
||||
@@ -358,6 +362,9 @@ void rdclog_int(LogType type, const char *file, unsigned int line, const char *f
|
||||
output += numWritten;
|
||||
available -= numWritten;
|
||||
|
||||
// -3 is for the " - " after the type.
|
||||
const char *noPrefixOutput = (output - 3 - (sizeof(typestr[type]) - 1));
|
||||
|
||||
numWritten = StringFormat::vsnprintf(output, available, fmt, args);
|
||||
|
||||
va_end(args);
|
||||
@@ -374,5 +381,5 @@ void rdclog_int(LogType type, const char *file, unsigned int line, const char *f
|
||||
*output = '\n';
|
||||
*(output + 1) = 0;
|
||||
|
||||
rdclogprint_int(rdclog_outputBuffer);
|
||||
rdclogprint_int(type, rdclog_outputBuffer, noPrefixOutput);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ void rdclog_flush();
|
||||
|
||||
// actual low-level print to log output streams defined (useful for if we need to print
|
||||
// fatal error messages from within the more complex log function).
|
||||
void rdclogprint_int(const char *str);
|
||||
void rdclogprint_int(LogType type, const char *fullMsg, const char *msg);
|
||||
|
||||
// printf() style main logger function
|
||||
void rdclog_int(LogType type, const char *file, unsigned int line, const char *fmt, ...);
|
||||
@@ -292,13 +292,13 @@ void rdclog_filename(const char *filename);
|
||||
RDCDUMP(); \
|
||||
exit(0); \
|
||||
} while((void)0, 0)
|
||||
#define RDCDUMPMSG(message) \
|
||||
do \
|
||||
{ \
|
||||
rdclogprint_int(message); \
|
||||
rdclog_flush(); \
|
||||
RDCDUMP(); \
|
||||
exit(0); \
|
||||
#define RDCDUMPMSG(message) \
|
||||
do \
|
||||
{ \
|
||||
rdclogprint_int(RDCLog_Fatal, message, message); \
|
||||
rdclog_flush(); \
|
||||
RDCDUMP(); \
|
||||
exit(0); \
|
||||
} while((void)0, 0)
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user