-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.h
75 lines (60 loc) · 2.63 KB
/
log.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* Filesystem helpers
* Copyright (C) 2007, 2008, 2009 Sylvain Beucler
* Copyright (C) 2022 CRTS
* This file is part of GNU FreeDink
* GNU FreeDink 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.
* GNU FreeDink is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _LOG_H
#define _LOG_H
#include "SDL.h"
extern int debug_mode;
#ifdef DEBUG
#define log_trace(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, \
__VA_ARGS__)
#define log_enter(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, \
"Enter: " __VA_ARGS__)
#define log_exit(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, \
"Exit: " __VA_ARGS__)
#else
#define log_trace(...)
#define log_enter(...)
#define log_exit(...)
#endif
#define log_debug(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, \
__VA_ARGS__)
#define log_info(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, \
__VA_ARGS__)
#define log_warn(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, \
__VA_ARGS__)
#define log_error(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, \
__VA_ARGS__)
#define log_fatal(...) \
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_CRITICAL, \
__VA_ARGS__)
/* Some macros for convenience */
#define RINFO_NAME(i) rinfo[i] != NULL ? rinfo[i]->name : "NULL"
extern void log_init();
extern void log_quit();
extern void log_debug_on(int);
extern void log_debug_off();
extern const char* log_getLastLog();
extern void log_set_output_file(const char* filename);
#endif