/[path-sandbox]/trunk/libsbutil/src/debug.c
Gentoo

Diff of /trunk/libsbutil/src/debug.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 406 Revision 407
9 */ 9 */
10 10
11#include "headers.h" 11#include "headers.h"
12#include "rcscripts/rcutil.h" 12#include "rcscripts/rcutil.h"
13 13
14volatile static bool debug_enabled = true;
15volatile static int debug_errno = 0; 14volatile static int debug_errno = 0;
16 15
17static char log_domain_default[] = "rcscripts"; 16static char log_domain_default[] = "rcscripts";
18static char *log_domain = log_domain_default; 17static char *log_domain = log_domain_default;
19 18
20void 19void
21rc_log_domain (const char *new_domain) 20rc_log_domain (const char *new_domain)
22{ 21{
23 if (check_str (new_domain)) 22 if (check_str (new_domain))
24 log_domain = (char *)new_domain; 23 log_domain = (char *)new_domain;
25}
26
27void
28rc_debug_enabled (bool enabled)
29{
30 debug_enabled = enabled;
31} 24}
32 25
33void 26void
34rc_errno_set (int rc_errno) 27rc_errno_set (int rc_errno)
35{ 28{
60 const char *format, ...) 53 const char *format, ...)
61{ 54{
62 va_list arg; 55 va_list arg;
63 char *format_str; 56 char *format_str;
64 int length; 57 int length;
65
66#if !defined(RC_DEBUG)
67 if (!debug_enabled)
68 return;
69#endif
70 58
71 length = strlen (log_domain) + strlen ("(): ") + 1; 59 length = strlen (log_domain) + strlen ("(): ") + 1;
72 /* Do not use xmalloc() here, else we may have recursive issues */ 60 /* Do not use xmalloc() here, else we may have recursive issues */
73 format_str = malloc (length); 61 format_str = malloc (length);
74 if (NULL == format_str) 62 if (NULL == format_str)

Legend:
Removed from v.406  
changed lines
  Added in v.407

  ViewVC Help
Powered by ViewVC 1.1.20