1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. 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, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ 25 #define __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ 26 27 //************************************************************************************************************* 28 // special macros for time measures 29 // 1) LOGFILE_FILTERDBG used it to define log file for this operations (default will be set automaticly) 30 // 4) LOG_FILTERDBG write debug info to log file 31 //************************************************************************************************************* 32 33 #ifdef ENABLE_FILTERDBG 34 35 //_________________________________________________________________________________________________________________ 36 // includes 37 //_________________________________________________________________________________________________________________ 38 39 #ifndef _RTL_STRBUF_HXX_ 40 #include <rtl/strbuf.hxx> 41 #endif 42 43 /*_____________________________________________________________________________________________________________ 44 LOGFILE_FILTERDBG 45 46 For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! 47 _____________________________________________________________________________________________________________*/ 48 49 #ifndef LOGFILE_FILTERDBG 50 #define LOGFILE_FILTERDBG "filterdbg.log" 51 #endif 52 53 /*_____________________________________________________________________________________________________________ 54 LOG_FILTERDBG( SOPERATION, SMESSAGE ) 55 56 Write special debug info to the log file. 57 _____________________________________________________________________________________________________________*/ 58 59 #define LOG_FILTERDBG( SOPERATION, SMESSAGE ) \ 60 { \ 61 ::rtl::OStringBuffer _sBuffer( 256 ); \ 62 _sBuffer.append( SOPERATION ); \ 63 _sBuffer.append( "\t" ); \ 64 _sBuffer.append( SMESSAGE ); \ 65 _sBuffer.append( "\n" ); \ 66 WRITE_LOGFILE( LOGFILE_FILTERDBG, _sBuffer.makeStringAndClear().getStr() ) \ 67 } 68 69 /*_____________________________________________________________________________________________________________ 70 LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) 71 72 Write special debug info into the log file and mark SNAME as special parameter before SMESSAGE is printed. 73 _____________________________________________________________________________________________________________*/ 74 75 #define LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) \ 76 { \ 77 ::rtl::OStringBuffer _sBuffer( 256 ); \ 78 _sBuffer.append( SOPERATION ); \ 79 _sBuffer.append( "\t\"" ); \ 80 _sBuffer.append( SPARAM ); \ 81 _sBuffer.append( "\" " ); \ 82 _sBuffer.append( SMESSAGE ); \ 83 _sBuffer.append( "\n" ); \ 84 WRITE_LOGFILE( LOGFILE_FILTERDBG, _sBuffer.makeStringAndClear().getStr() ) \ 85 } 86 87 /*_____________________________________________________________________________________________________________ 88 LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) 89 90 Write special debug info to the log file, if given condition returns true. 91 _____________________________________________________________________________________________________________*/ 92 93 #define LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) \ 94 if (CONDITION) \ 95 LOG_FILTERDBG( SOPERATION, SMESSAGE ) 96 97 /*_____________________________________________________________________________________________________________ 98 LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) 99 100 Write special debug info into the log file and mark SNAME as special parameter before SMESSAGE is printed. 101 But it will be done only, if CONDITION returns true. 102 _____________________________________________________________________________________________________________*/ 103 104 #define LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) \ 105 if (CONDITION) \ 106 LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) 107 108 #else // #ifdef ENABLE_FILTERDBG 109 110 /*_____________________________________________________________________________________________________________ 111 If right testmode is'nt set - implements these macros empty! 112 _____________________________________________________________________________________________________________*/ 113 114 #undef LOGFILE_FILTERDBG 115 #define LOG_FILTERDBG( SOPERATION, SMESSAGE ) 116 #define LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) 117 #define LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) 118 #define LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) 119 120 #endif // #ifdef ENABLE_FILTERDBG 121 122 //***************************************************************************************************************** 123 // end of file 124 //***************************************************************************************************************** 125 126 #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ 127