14642e01fSmrg/* 2ed6184dfSmrg * Xephyr - A kdrive X server that runs in a host X window. 34642e01fSmrg * Authored by Matthew Allum <mallum@openedhand.com> 435c4bbdfSmrg * 535c4bbdfSmrg * Copyright © 2007 OpenedHand Ltd 64642e01fSmrg * 74642e01fSmrg * Permission to use, copy, modify, distribute, and sell this software and its 84642e01fSmrg * documentation for any purpose is hereby granted without fee, provided that 94642e01fSmrg * the above copyright notice appear in all copies and that both that 104642e01fSmrg * copyright notice and this permission notice appear in supporting 114642e01fSmrg * documentation, and that the name of OpenedHand Ltd not be used in 124642e01fSmrg * advertising or publicity pertaining to distribution of the software without 134642e01fSmrg * specific, written prior permission. OpenedHand Ltd makes no 144642e01fSmrg * representations about the suitability of this software for any purpose. It 154642e01fSmrg * is provided "as is" without express or implied warranty. 164642e01fSmrg * 174642e01fSmrg * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 184642e01fSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 194642e01fSmrg * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR 204642e01fSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 214642e01fSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 224642e01fSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 234642e01fSmrg * PERFORMANCE OF THIS SOFTWARE. 244642e01fSmrg * 254642e01fSmrg * Authors: 264642e01fSmrg * Dodji Seketeli <dodji@openedhand.com> 274642e01fSmrg */ 284642e01fSmrg#ifndef __EPHYRLOG_H__ 294642e01fSmrg#define __EPHYRLOG_H__ 304642e01fSmrg 314642e01fSmrg#include <assert.h> 324642e01fSmrg#include "os.h" 334642e01fSmrg 344642e01fSmrg#ifndef DEBUG 354642e01fSmrg/*we are not in debug mode*/ 364642e01fSmrg#define EPHYR_LOG(...) 374642e01fSmrg#define EPHYR_LOG_ERROR(...) 3835c4bbdfSmrg#endif /*!DEBUG */ 394642e01fSmrg 404642e01fSmrg#define ERROR_LOG_LEVEL 3 414642e01fSmrg#define INFO_LOG_LEVEL 4 424642e01fSmrg 434642e01fSmrg#ifndef EPHYR_LOG 444642e01fSmrg#define EPHYR_LOG(...) \ 454642e01fSmrgLogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, "in %s:%d:%s: ",\ 464642e01fSmrg __FILE__, __LINE__, __func__) ; \ 474642e01fSmrgLogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, __VA_ARGS__) 4835c4bbdfSmrg#endif /*nomadik_log */ 494642e01fSmrg 504642e01fSmrg#ifndef EPHYR_LOG_ERROR 514642e01fSmrg#define EPHYR_LOG_ERROR(...) \ 524642e01fSmrgLogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, "Error:in %s:%d:%s: ",\ 534642e01fSmrg __FILE__, __LINE__, __func__) ; \ 544642e01fSmrgLogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, __VA_ARGS__) 5535c4bbdfSmrg#endif /*EPHYR_LOG_ERROR */ 564642e01fSmrg 574642e01fSmrg#ifndef EPHYR_RETURN_IF_FAIL 584642e01fSmrg#define EPHYR_RETURN_IF_FAIL(cond) \ 594642e01fSmrgif (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return;} 6035c4bbdfSmrg#endif /*nomadik_return_if_fail */ 614642e01fSmrg 624642e01fSmrg#ifndef EPHYR_RETURN_VAL_IF_FAIL 634642e01fSmrg#define EPHYR_RETURN_VAL_IF_FAIL(cond,val) \ 644642e01fSmrgif (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return val;} 6535c4bbdfSmrg#endif /*nomadik_return_val_if_fail */ 664642e01fSmrg 674642e01fSmrg#endif /*__EPHYRLOG_H__*/ 68