Commit | Line | Data |
---|---|---|
a09e091a JB |
1 | /* |
2 | * Xephyr - A kdrive X server thats runs in a host X window. | |
3 | * Authored by Matthew Allum <mallum@openedhand.com> | |
4 | * | |
5 | * Copyright © 2007 OpenedHand Ltd | |
6 | * | |
7 | * Permission to use, copy, modify, distribute, and sell this software and its | |
8 | * documentation for any purpose is hereby granted without fee, provided that | |
9 | * the above copyright notice appear in all copies and that both that | |
10 | * copyright notice and this permission notice appear in supporting | |
11 | * documentation, and that the name of OpenedHand Ltd not be used in | |
12 | * advertising or publicity pertaining to distribution of the software without | |
13 | * specific, written prior permission. OpenedHand Ltd makes no | |
14 | * representations about the suitability of this software for any purpose. It | |
15 | * is provided "as is" without express or implied warranty. | |
16 | * | |
17 | * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
18 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | |
19 | * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
20 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | |
21 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
22 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
23 | * PERFORMANCE OF THIS SOFTWARE. | |
24 | * | |
25 | * Authors: | |
26 | * Dodji Seketeli <dodji@openedhand.com> | |
27 | */ | |
28 | #ifndef __EPHYRLOG_H__ | |
29 | #define __EPHYRLOG_H__ | |
30 | ||
31 | #include <assert.h> | |
32 | #include "os.h" | |
33 | ||
34 | #ifndef DEBUG | |
35 | /*we are not in debug mode*/ | |
36 | #define EPHYR_LOG(...) | |
37 | #define EPHYR_LOG_ERROR(...) | |
38 | #endif /*!DEBUG */ | |
39 | ||
40 | #define ERROR_LOG_LEVEL 3 | |
41 | #define INFO_LOG_LEVEL 4 | |
42 | ||
43 | #ifndef EPHYR_LOG | |
44 | #define EPHYR_LOG(...) \ | |
45 | LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, "in %s:%d:%s: ",\ | |
46 | __FILE__, __LINE__, __func__) ; \ | |
47 | LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, __VA_ARGS__) | |
48 | #endif /*nomadik_log */ | |
49 | ||
50 | #ifndef EPHYR_LOG_ERROR | |
51 | #define EPHYR_LOG_ERROR(...) \ | |
52 | LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, "Error:in %s:%d:%s: ",\ | |
53 | __FILE__, __LINE__, __func__) ; \ | |
54 | LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, __VA_ARGS__) | |
55 | #endif /*EPHYR_LOG_ERROR */ | |
56 | ||
57 | #ifndef EPHYR_RETURN_IF_FAIL | |
58 | #define EPHYR_RETURN_IF_FAIL(cond) \ | |
59 | if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return;} | |
60 | #endif /*nomadik_return_if_fail */ | |
61 | ||
62 | #ifndef EPHYR_RETURN_VAL_IF_FAIL | |
63 | #define EPHYR_RETURN_VAL_IF_FAIL(cond,val) \ | |
64 | if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return val;} | |
65 | #endif /*nomadik_return_val_if_fail */ | |
66 | ||
67 | #endif /*__EPHYRLOG_H__*/ |