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