1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_
21 #define __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_
23 //*****************************************************************************************************************
24 // generic macros for logging
25 //*****************************************************************************************************************
27 #ifdef ENABLE_LOGMECHANISM
29 #include <rtl/string.hxx>
32 /*_____________________________________________________________________________________________________________
33 WRITE_LOGFILE( SFILENAME, STEXT )
35 Log any information in file. We append any information at file and don't clear it anymore.
36 ( Use new scope in macro to declare pFile more then on time in same "parentscope"!
37 Don't control pFile before access! What will you doing if its not valid? Log an error ...
38 An error and an error is an error ... )
40 Attention: You must use "%s" and STEXT as parameter ... because otherwise encoded strings (they include e.g. %...)
42 _____________________________________________________________________________________________________________*/
44 #define WRITE_LOGFILE( SFILENAME, STEXT ) \
46 OString _swriteLogfileFileName ( SFILENAME ); \
47 OString _swriteLogfileText ( STEXT ); \
48 FILE* pFile = fopen( _swriteLogfileFileName.getStr(), "a" ); \
49 fprintf( pFile, "%s", _swriteLogfileText.getStr() ); \
53 /*_____________________________________________________________________________________________________________
56 For other debug macros we need information about the output mode. If user forget to set this information we
57 do it for him. Valid values are: LOGTYPE_FILECONTINUE
60 The normal case is LOGTYPE_MESSAGEBOX to show assertions in normal manner!
61 _____________________________________________________________________________________________________________*/
63 #define LOGTYPE_MESSAGEBOX 1
64 #define LOGTYPE_FILECONTINUE 2
65 #define LOGTYPE_FILEEXIT 3
72 #else // #ifdef ENABLE_LOGMECHANISM
74 /*_____________________________________________________________________________________________________________
75 If right testmode is'nt set - implements these macro empty!
76 _____________________________________________________________________________________________________________*/
78 #define WRITE_LOGFILE( SFILENAME, STEXT )
81 #endif // #ifdef ENABLE_LOGMECHANISM
83 #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */