forked from tinylcy/vino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.h
More file actions
22 lines (15 loc) · 640 Bytes
/
debug.h
File metadata and controls
22 lines (15 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* Copyright (C) Chenyang Li
* Copyright (C) tinyhttpd
*/
#ifndef DBG_H
#define DBG_H
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#define describ_errno() (errno == 0 ? "None" : strerror(errno))
#define log_info(M, ...) fprintf(stdout, "[INFO] (%s:%d: errno: %s) " #M "\n", __FILE__, __LINE__, describ_errno(), ##__VA_ARGS__)
#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d: errno: %s) " #M "\n", __FILE__, __LINE__, describ_errno(), ##__VA_ARGS__)
#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " #M "\n", __FILE__, __LINE__, describ_errno(), ##__VA_ARGS__)
#endif