~ubuntu-branches/debian/sid/trinity/sid

« back to all changes in this revision

Viewing changes to include/log.h

  • Committer: Package Import Robot
  • Author(s): gustavo panizzo
  • Date: 2014-01-17 21:10:15 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140117211015-k2qbnpu0osa5mlil
Tags: 1.3-1
* New upstream version 1.3.
* Removed wrong dependency on linux-headers. (Closes: #733771).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef _LOG_H
2
2
#define _LOG_H 1
3
3
 
 
4
#include <unistd.h>
 
5
#include "types.h"
 
6
#include "exit.h"
 
7
#include "shm.h"
 
8
 
4
9
#define ANSI_RED        ""
5
10
#define ANSI_GREEN      ""
6
11
#define ANSI_YELLOW     ""
19
24
#define WHITE if (monochrome == FALSE)  sptr += sprintf(sptr, "%s", ANSI_WHITE);
20
25
#define CRESET if (monochrome == FALSE) sptr += sprintf(sptr, "%s", ANSI_RESET);
21
26
 
 
27
#define REDFD if (mono == FALSE)        fprintf(fd, "%s", ANSI_RED);
 
28
#define GREENFD if (mono == FALSE)      fprintf(fd, "%s", ANSI_GREEN);
 
29
#define CRESETFD if (mono == FALSE)     fprintf(fd, "%s", ANSI_RESET);
 
30
 
22
31
#define MAX_LOGLEVEL 3
23
32
unsigned int highest_logfile(void);
24
33
void synclogs(void);
25
34
void output(unsigned char level, const char *fmt, ...);
 
35
void outputerr(const char *fmt, ...);
 
36
void outputstd(const char *fmt, ...);
 
37
void output_syscall_prefix(const unsigned int childno, const unsigned int syscallno);
 
38
void output_syscall_postfix(unsigned long ret, int errno_saved, bool err);
 
39
 
26
40
void open_logfiles(void);
27
41
void close_logfiles(void);
 
42
void debugf(const char *fmt, ...);
28
43
 
29
44
#define __stringify_1(x...)     #x
30
45
#define __stringify(x...)       __stringify_1(x)
35
50
#define BUGTXT ANSI_RED "BUG!: " ANSI_RESET GIT_VERSION
36
51
#endif
37
52
 
 
53
#define BUG(bugtxt)     { \
 
54
        printf("[%d] %s:%s:%d %s", getpid(), __FILE__, __func__, __LINE__, bugtxt); \
 
55
        while(1) { \
 
56
                if (shm->exit_reason == EXIT_SIGINT) \
 
57
                        exit(EXIT_FAILURE);     \
 
58
                sleep(1); \
 
59
        }\
 
60
}
38
61
 
39
 
#define BUG(bugtxt)     { printf("%s:%s:%d %s", __FILE__, __func__, __LINE__, bugtxt); while(1); }
 
62
#define BUG_ON(condition)       do { if ((condition)) BUG(BUGTXT); } while (0)
40
63
 
41
64
#endif  /* _LOG_H */