File: evdi_debug.h

package info (click to toggle)
evdi 1.14.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 576 kB
  • sloc: ansic: 5,575; cpp: 474; python: 163; sh: 147; makefile: 143
file content (57 lines) | stat: -rw-r--r-- 1,803 bytes parent folder | download | duplicates (2)
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
/* SPDX-License-Identifier: GPL-2.0-only
 * Copyright (c) 2015 - 2019 DisplayLink (UK) Ltd.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License v2. See the file COPYING in the main directory of this archive for
 * more details.
 */

#ifndef EVDI_DEBUG_H
#define EVDI_DEBUG_H

#include "evdi_params.h"

#define EVDI_LOGLEVEL_FATAL   1
#define EVDI_LOGLEVEL_ERROR   2
#define EVDI_LOGLEVEL_WARN    3
#define EVDI_LOGLEVEL_INFO    4
#define EVDI_LOGLEVEL_DEBUG   5
#define EVDI_LOGLEVEL_VERBOSE 6

#define EVDI_PRINTK(KERN_LEVEL, LEVEL, FORMAT_STR, ...)	do { \
	if (evdi_loglevel >= LEVEL) {\
		printk(KERN_LEVEL "evdi: " FORMAT_STR, ##__VA_ARGS__); \
	} \
} while (0)

#define EVDI_FATAL(FORMAT_STR, ...) \
	EVDI_PRINTK(KERN_CRIT, EVDI_LOGLEVEL_FATAL,\
		    "[F] %s:%d " FORMAT_STR, __func__, __LINE__, ##__VA_ARGS__)

#define EVDI_ERROR(FORMAT_STR, ...) \
	EVDI_PRINTK(KERN_ERR, EVDI_LOGLEVEL_ERROR,\
		    "[E] %s:%d " FORMAT_STR, __func__, __LINE__, ##__VA_ARGS__)

#define EVDI_WARN(FORMAT_STR, ...) \
	EVDI_PRINTK(KERN_WARNING, EVDI_LOGLEVEL_WARN,\
		    "[W] %s:%d " FORMAT_STR, __func__, __LINE__, ##__VA_ARGS__)

#define EVDI_INFO(FORMAT_STR, ...) \
	EVDI_PRINTK(KERN_DEFAULT, EVDI_LOGLEVEL_INFO,\
		    "[I] " FORMAT_STR, ##__VA_ARGS__)

#define EVDI_DEBUG(FORMAT_STR, ...) \
	EVDI_PRINTK(KERN_DEFAULT, EVDI_LOGLEVEL_DEBUG,\
		    "[D] %s:%d " FORMAT_STR, __func__, __LINE__, ##__VA_ARGS__)

#define EVDI_VERBOSE(FORMAT_STR, ...) \
	EVDI_PRINTK(KERN_DEFAULT, EVDI_LOGLEVEL_VERBOSE,\
		    "[V] %s:%d " FORMAT_STR, __func__, __LINE__, ##__VA_ARGS__)

#define EVDI_CHECKPT() EVDI_VERBOSE("\n")
#define EVDI_ENTER() EVDI_VERBOSE("enter\n")
#define EVDI_EXIT() EVDI_VERBOSE("exit\n")

void evdi_log_process(char *buf, size_t size);

#endif /* EVDI_DEBUG_H */