libcsdbg  1.28
C++ exception (and generic) stack trace debug library
void csdbg::util::dbg ( const i8 tag,
const i8 fmt,
va_list  args 
)
static

Print a tagged debug message on the standard error stream.

Parameters
[in]tagthe message tag
[in]fmta printf-style format string
[in]argsa variable argument list (as a va_list variable)
Note
Deprecated if debugging is disabled

Definition at line 641 of file util.cpp.

References __D_ASSERT, header(), likely, lock(), unlikely, unlock(), and va_format().

Referenced by dbg_error(), dbg_info(), and dbg_warn().

642 {
643 #ifdef CSDBG_WITH_DEBUG
644  __D_ASSERT(tag != NULL);
645  __D_ASSERT(fmt != NULL);
646  if ( unlikely(tag == NULL || fmt == NULL) ) {
647  va_end(args);
648  return;
649  }
650 
651  i8 *msg = NULL;
652  try {
653  msg = va_format(fmt, args);
654 
655  lock();
656  if ( likely(!isspace(fmt[0])) )
657  header(std::cerr, tag);
658 
659  std::cerr << msg << "\r\n";
660  delete[] msg;
661  unlock();
662  }
663 
664  catch (...) {
665  __D_ASSERT(msg != NULL);
666  }
667 #endif
668 }
char i8
8-bit signed integer
Definition: config.hpp:72
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
static void lock()
Lock the global access mutex.
Definition: util.cpp:397
static void unlock()
Unlock the global access mutex.
Definition: util.cpp:406
static i8 * va_format(const i8 *, va_list)
Format a buffer with a printf-style string expanded with the values of a variable argument list...
Definition: util.cpp:519
static void header(std::ostream &, const i8 *)
Print a tagged message header on an output stream.
Definition: util.cpp:594
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349
#define __D_ASSERT(x)
Assertion macro.
Definition: config.hpp:268

+ Here is the call graph for this function:

+ Here is the caller graph for this function: