Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Enduro/X Object-API Debug library header, ATMI level
0003  *
0004  * @file odebug.h
0005  */
0006 /* -----------------------------------------------------------------------------
0007  * Enduro/X Middleware Platform for Distributed Transaction Processing
0008  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010  * This software is released under one of the following licenses:
0011  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012  * See LICENSE file for full text.
0013  * -----------------------------------------------------------------------------
0014  * AGPL license:
0015  *
0016  * This program is free software; you can redistribute it and/or modify it under
0017  * the terms of the GNU Affero General Public License, version 3 as published
0018  * by the Free Software Foundation;
0019  *
0020  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023  * for more details.
0024  *
0025  * You should have received a copy of the GNU Affero General Public License along 
0026  * with this program; if not, write to the Free Software Foundation, Inc.,
0027  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028  *
0029  * -----------------------------------------------------------------------------
0030  * A commercial use license is available from Mavimax, Ltd
0031  * contact@mavimax.com
0032  * -----------------------------------------------------------------------------
0033  */
0034 #ifndef ODEBUG_H
0035 #define ODEBUG_H
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 /*---------------------------Includes-----------------------------------*/
0041 #include <ndrx_config.h>
0042 #include <stdio.h>
0043 #include <limits.h>
0044 #include <thlock.h>
0045 #include <stdarg.h>
0046 #include <ndebugcmn.h>
0047 #include <nstd_tls.h>
0048 #include <ndebug.h>
0049 #include <atmi.h>
0050 /*---------------------------Externs------------------------------------*/
0051 /*---------------------------Macros-------------------------------------*/
0052 /* Kind of GCC way only... */
0053 #define ONDRX_LOG(p_ctxt, lev, fmt, ...) {NDRX_DBG_INIT_ENTRY; if (lev<=G_ndrx_debug.level)\
0054             {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0055                 __ndrx_debug__(&G_ndrx_debug, lev, __FILE__, __LINE__, __func__, fmt, ##__VA_ARGS__);\
0056             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0057             }}
0058 
0059 #define OUBF_LOG(p_ctxt, lev, fmt, ...) {NDRX_DBG_INIT_ENTRY; if (lev<=G_ubf_debug.level)\
0060             {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0061             __ndrx_debug__(&G_ubf_debug, lev, __FILE__, __LINE__, __func__, fmt, ##__VA_ARGS__);\
0062             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0063             }}
0064     
0065 /* User logging */
0066 #define OTP_LOG(p_ctxt, lev, fmt, ...) {NDRX_DBG_INIT_ENTRY; if (lev<=G_tp_debug.level)\
0067         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0068             __ndrx_debug__(&G_tp_debug, lev, __FILE__, __LINE__, __func__, fmt, ##__VA_ARGS__);\
0069             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0070             }}
0071 
0072 
0073 #define OUBF_DUMP(p_ctxt, lev,comment,ptr,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_ndrx_debug.level)\
0074         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0075             __ndrx_debug_dump__(&G_ndrx_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, len);\
0076             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0077             }}
0078 
0079 #define ONDRX_DUMP(p_ctxt, lev,comment,ptr,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_ndrx_debug.level)\
0080         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0081             __ndrx_debug_dump__(&G_ubf_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, len);\
0082             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0083             }}
0084 
0085 #define OSTDOUT_DUMP(p_ctxt, lev,comment,ptr,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_stdout_debug.level)\
0086         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0087             __ndrx_debug_dump__(&G_stdout_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, len);\
0088             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0089             }}
0090 
0091 #define OTP_DUMP(p_ctxt, lev,comment,ptr,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_tp_debug.level)\
0092         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0093             __ndrx_debug_dump__(&G_tp_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, len);\
0094             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0095             }}
0096 
0097 #define OUBF_DUMP_DIFF(p_ctxt, lev,comment,ptr,ptr2,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_ndrx_debug.level)\
0098         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0099             __ndrx_debug_dump_diff__(&G_ndrx_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, ptr2, len);\
0100             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0101             }}
0102 
0103 #define ONDRX_DUMP_DIFF(p_ctxt, lev,comment,ptr,ptr2,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_ndrx_debug.level)\
0104         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0105             __ndrx_debug_dump_diff__(&G_ubf_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, ptr2, len);\
0106             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0107             }}
0108 
0109 #define OTP_DUMP_DIFF(p_ctxt, lev,comment,ptr,ptr2,len) {NDRX_DBG_INIT_ENTRY; if (lev<=G_tp_debug.level)\
0110         {ndrx_tpsetctxt(*p_ctxt, 0, CTXT_PRIV_NSTD); \
0111             __ndrx_debug_dump_diff__(&G_tp_debug, lev, __FILE__, __LINE__, __func__, comment, ptr, ptr2, len);\
0112             ndrx_tpgetctxt(p_ctxt, 0, CTXT_PRIV_NSTD);\
0113             }}
0114 /*---------------------------Enums--------------------------------------*/
0115 /*---------------------------Typedefs-----------------------------------*/
0116 /*---------------------------Globals------------------------------------*/
0117 /*---------------------------Statics------------------------------------*/
0118 /*---------------------------Prototypes---------------------------------*/
0119 
0120 #ifdef  __cplusplus
0121 }
0122 #endif
0123 
0124 #endif  /* ODEBUG_H */
0125 
0126 /* vim: set ts=4 sw=4 et smartindent: */