forked from luke-jr/bfgminer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.h
57 lines (47 loc) · 1.66 KB
/
logging.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Copyright 2012 zefir
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version. See COPYING for more details.
*/
#ifndef __LOGGING_H__
#define __LOGGING_H__
#include "config.h"
#include <stdbool.h>
#include <stdarg.h>
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#else
enum {
LOG_ERR,
LOG_WARNING,
LOG_NOTICE,
LOG_INFO,
LOG_DEBUG,
};
#endif
/* original / legacy debug flags */
extern bool opt_debug;
extern bool opt_debug_console;
extern bool opt_log_output;
extern bool opt_realquiet;
extern bool want_per_device_stats;
/* global log_level, messages with lower or equal prio are logged */
extern int opt_log_level;
/* low-level logging functions with priority parameter */
extern void vapplog(int prio, const char *fmt, va_list ap) FORMAT_SYNTAX_CHECK(printf, 2, 0);
extern void applog(int prio, const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 2, 3);
#define applogr(rv, prio, ...) do { \
applog(prio, __VA_ARGS__); \
return rv; \
} while (0)
/* high-level logging functions with implicit priority */
extern void log_error(const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
extern void log_warning(const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
extern void log_notice(const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
extern void log_info(const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
extern void log_debug(const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 1, 2);
extern void hexdump(const void *, unsigned int len);
#endif /* __LOGGING_H__ */