UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 #ifndef _RTL_LOGFILE_HXX_ 00029 #define _RTL_LOGFILE_HXX_ 00030 00031 #include <rtl/logfile.h> 00032 #include <rtl/string.hxx> 00033 00034 namespace rtl 00035 { 00101 class Logfile 00102 { 00103 public: 00104 inline Logfile( const sal_Char *name ); 00113 inline Logfile( const sal_Char *project, const sal_Char *author, const sal_Char *name ); 00114 inline ~Logfile(); 00115 inline const sal_Char *getName(); 00116 private: 00117 ::rtl::OString m_sName; 00118 }; 00119 00120 inline Logfile::Logfile( const sal_Char *name ) 00121 : m_sName( name ) 00122 { 00123 rtl_logfile_longTrace( "{ %s\n", name ); 00124 } 00125 00126 inline Logfile::Logfile( const sal_Char *project, const sal_Char *author, const sal_Char *name ) 00127 : m_sName( project) 00128 { 00129 m_sName += " ("; 00130 m_sName += author; 00131 m_sName += ") "; 00132 m_sName += name; 00133 rtl_logfile_longTrace( "{ %s\n", m_sName.pData->buffer ); 00134 } 00135 00136 inline Logfile::~Logfile() 00137 { 00138 rtl_logfile_longTrace( "} %s\n", m_sName.pData->buffer ); 00139 } 00140 00141 inline const sal_Char * Logfile::getName() 00142 { 00143 return m_sName.getStr(); 00144 } 00145 } 00146 00147 #ifdef TIMELOG 00148 #define RTL_LOGFILE_CONTEXT( instance, name ) ::rtl::Logfile instance( name ) 00149 #define RTL_LOGFILE_CONTEXT_AUTHOR( instance, project, author, name ) ::rtl::Logfile instance(project, author, name ) 00150 #define RTL_LOGFILE_CONTEXT_TRACE( instance, message ) \ 00151 rtl_logfile_longTrace( "| %s : %s\n", \ 00152 instance.getName(), \ 00153 message ) 00154 #define RTL_LOGFILE_CONTEXT_TRACE1( instance , frmt, arg1 ) \ 00155 rtl_logfile_longTrace( "| %s : ", \ 00156 instance.getName() ); \ 00157 rtl_logfile_trace( frmt , arg1 ); \ 00158 rtl_logfile_trace( "\n" ) 00159 #define RTL_LOGFILE_CONTEXT_TRACE2( instance , frmt, arg1 , arg2 ) \ 00160 rtl_logfile_longTrace( "| %s : ", \ 00161 instance.getName() ); \ 00162 rtl_logfile_trace( frmt , arg1 , arg2 ); \ 00163 rtl_logfile_trace( "\n" ) 00164 #define RTL_LOGFILE_CONTEXT_TRACE3( instance , frmt, arg1 , arg2 , arg3 ) \ 00165 rtl_logfile_longTrace( "| %s : ", \ 00166 instance.getName() ); \ 00167 rtl_logfile_trace( frmt , arg1 , arg2 , arg3 ); \ 00168 rtl_logfile_trace( "\n" ) 00169 00170 #else 00171 #define RTL_LOGFILE_CONTEXT( instance, name ) ((void)0) 00172 #define RTL_LOGFILE_CONTEXT_AUTHOR( instance, project, author, name ) ((void)0) 00173 #define RTL_LOGFILE_CONTEXT_TRACE( instance, message ) ((void)0) 00174 #define RTL_LOGFILE_CONTEXT_TRACE1( instance, frmt, arg1 ) ((void)0) 00175 #define RTL_LOGFILE_CONTEXT_TRACE2( instance, frmt, arg1, arg2 ) ((void)0) 00176 #define RTL_LOGFILE_CONTEXT_TRACE3( instance, frmt, arg1, arg2 , arg3 ) ((void)0) 00177 #endif 00178 00179 // Normal RTL_LOGFILE_* entries will not make it into release versions, 00180 // TIMELOG is disabled a few versions prior relase build. 00181 // 00182 // We need some logs also in these builds, eg. for making performance regression tests. 00183 // 00184 // POLICY: Don't use RTL_LOGFILE_PRODUCT_* for your personal logging information. 00185 // Be aware that these logs make it into the product shipped to customers. 00186 // If you have good reasons for doing this, please contact product management. 00187 00188 #define RTL_LOGFILE_PRODUCT_TRACE( string ) \ 00189 rtl_logfile_longTrace( "| : %s\n", string ) 00190 #define RTL_LOGFILE_PRODUCT_TRACE1( frmt, arg1 ) \ 00191 rtl_logfile_longTrace( "| : " ); \ 00192 rtl_logfile_trace( frmt, arg1 ); \ 00193 rtl_logfile_trace( "\n" ) 00194 #define RTL_LOGFILE_PRODUCT_CONTEXT( instance, name ) \ 00195 ::rtl::Logfile instance( name ) 00196 #define RTL_LOGFILE_PRODUCT_CONTEXT_TRACE1( instance, frmt, arg1 ) \ 00197 rtl_logfile_longTrace( "| %s : ", \ 00198 instance.getName() ); \ 00199 rtl_logfile_trace( frmt, arg1 ); \ 00200 rtl_logfile_trace( "\n" ) 00201 #define RTL_LOGFILE_HASLOGFILE() \ 00202 rtl_logfile_hasLogFile() 00203 00204 00205 #endif 00206 00207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */