File: debug_msg.c

package info (click to toggle)
ganglia 3.7.2-7
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,088 kB
  • sloc: ansic: 28,847; sh: 12,202; python: 8,357; makefile: 503; perl: 366; php: 61; xml: 28
file content (41 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
 * @file debug_msg.c Debug Message function
 */
#include <stdio.h>
#include <stdarg.h>

int debug_level = 0;

/**
 * @fn void debug_msg(const char *format, ...)
 * Prints the message to STDERR if DEBUG is #defined
 * @param format The format of the msg (see printf manpage)
 * @param ... Optional arguments
 */
void
debug_msg(const char *format, ...)
{
   if (debug_level > 1 && format)
      {
         va_list ap;
         va_start(ap, format);
         vfprintf(stderr, format, ap);
         fprintf(stderr,"\n");
         va_end(ap);
      } 
   return;
}

void
set_debug_msg_level(int level)
{
    debug_level = level;
    return;
}

int
get_debug_msg_level()
{
    return debug_level;
}