Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / include / freerdp / utils / debug.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Debug Utils
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __UTILS_DEBUG_H
21 #define __UTILS_DEBUG_H
22
23 #include "config.h"
24
25 #include <stdio.h>
26
27 #define DEBUG_NULL(fmt, ...) do { } while (0)
28 #define DEBUG_PRINT(_dbg_str, fmt, ...) printf(_dbg_str fmt "\n" , __FUNCTION__, __LINE__, ## __VA_ARGS__)
29 #define DEBUG_CLASS(_dbg_class, fmt, ...) DEBUG_PRINT("DBG_" #_dbg_class " %s (%d): ", fmt, ## __VA_ARGS__)
30 #define DEBUG_WARN(fmt, ...) DEBUG_PRINT("Warning %s (%d): ", fmt, ## __VA_ARGS__)
31
32 #ifdef WITH_DEBUG
33 #define DEBUG(fmt, ...) DEBUG_PRINT("DBG %s (%d): ", fmt, ## __VA_ARGS__)
34 #else
35 #define DEBUG(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
36 #endif
37
38 #endif /* __UTILS_DEBUG_H */