File: liborange_log.c

package info (click to toggle)
orange 0.4-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,760 kB
  • sloc: sh: 9,533; ansic: 4,472; makefile: 46
file content (34 lines) | stat: -rw-r--r-- 560 bytes parent folder | download | duplicates (3)
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
#ifdef HAVE_CONFIG_H 
#include "config.h"
#endif
#include "liborange_log.h"

#if !WITH_LIBSYNCE

#include <stdarg.h>
#include <stdio.h>

static int current_log_level = ORANGE_LOG_LEVEL_HIGHEST;

void orange_log_set_level(int level)
{
  current_log_level = level;
}

void _orange_log(int level, const char* file, int line, const char* format, ...)
{
  va_list ap;

  if (level > current_log_level)
    return;

  fprintf(stderr, "[%s:%i] ", file, line);

  va_start(ap, format);
  vfprintf(stderr, format, ap);
  va_end(ap);

  fprintf(stderr, "\n");
}

#endif