LibreOffice
LibreOffice 4.2 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
logfile.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_RTL_LOGFILE_H
20 #define INCLUDED_RTL_LOGFILE_H
21 
22 #include <sal/config.h>
23 
24 #include <sal/saldllapi.h>
25 #include <sal/types.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
46 SAL_DLLPUBLIC void SAL_CALL rtl_logfile_trace( const sal_Char* pszFormat, ... );
47 
60 SAL_DLLPUBLIC void SAL_CALL rtl_logfile_longTrace(char const * format, ...);
61 
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #ifdef TIMELOG
75 #define RTL_LOGFILE_TRACE( string ) \
76  rtl_logfile_longTrace( "| : %s\n", string )
77 #define RTL_LOGFILE_TRACE1( frmt, arg1 ) \
78  rtl_logfile_longTrace( "| : " ); \
79  rtl_logfile_trace( frmt, arg1 ); \
80  rtl_logfile_trace( "\n" )
81 
82 #define RTL_LOGFILE_TRACE2( frmt, arg1 , arg2 ) \
83  rtl_logfile_longTrace( "| : " ); \
84  rtl_logfile_trace( frmt, arg1 , arg2 ); \
85  rtl_logfile_trace( "\n" )
86 #define RTL_LOGFILE_TRACE3( frmt, arg1 , arg2 , arg3 ) \
87  rtl_logfile_longTrace( "| : " ); \
88  rtl_logfile_trace( frmt, arg1 , arg2 , arg3 ); \
89  rtl_logfile_trace( "\n" )
90 
91 // Now the macros with project and author arguments. The strings
92 // are formatted in a way, so that the log file can be parsed by
93 // post processing scripts.
94 #define RTL_LOGFILE_TRACE_AUTHOR( project, author, string ) \
95  rtl_logfile_longTrace( "| %s (%s) : %s\n", \
96  project,\
97  author,\
98  string )
99 #define RTL_LOGFILE_TRACE_AUTHOR1( project, author, frmt, arg1 ) \
100  rtl_logfile_longTrace( "| %s (%s) : ", \
101  project,\
102  author );\
103  rtl_logfile_trace( frmt, arg1 ); \
104  rtl_logfile_trace( "\n" )
105 
106 #define RTL_LOGFILE_TRACE_AUTHOR2( project, author, frmt, arg1 , arg2 ) \
107  rtl_logfile_longTrace( "| %s (%s) : ", \
108  project,\
109  author ); \
110  rtl_logfile_trace( frmt, arg1 , arg2 ); \
111  rtl_logfile_trace( "\n" )
112 #define RTL_LOGFILE_TRACE_AUTHOR3( project, author, frmt, arg1 , arg2 , arg3 ) \
113  rtl_logfile_longTrace( "| %s (%s) : ", \
114  project,\
115  author ); \
116  rtl_logfile_trace( frmt, arg1 , arg2 , arg3 ); \
117  rtl_logfile_trace( "\n" )
118 #else
119 #define RTL_LOGFILE_TRACE( string ) ((void)0)
120 #define RTL_LOGFILE_TRACE1( frmt, arg1 ) ((void)0)
121 #define RTL_LOGFILE_TRACE2( frmt, arg1 , arg2 ) ((void)0)
122 #define RTL_LOGFILE_TRACE3( frmt, arg1 , arg2 , arg3 ) ((void)0)
123 
124 #define RTL_LOGFILE_TRACE_AUTHOR( project, author, string ) ((void)0)
125 #define RTL_LOGFILE_TRACE_AUTHOR1( project, author, frmt, arg1 ) ((void)0)
126 #define RTL_LOGFILE_TRACE_AUTHOR2( project, author, frmt, arg1 , arg2 ) ((void)0)
127 #define RTL_LOGFILE_TRACE_AUTHOR3( project, author, frmt, arg1 , arg2 , arg3 ) ((void)0)
128 #endif // TIMELOG
129 #endif
130 
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC sal_Bool rtl_logfile_hasLogFile(void)
Return if a log file is written.
SAL_DLLPUBLIC void rtl_logfile_longTrace(char const *format,...)
Like rtl_logfile_trace, but prefixing every log entry with the current time and thread ID...
SAL_DLLPUBLIC void rtl_logfile_trace(const sal_Char *pszFormat,...)
This function allows to log arbitrary messages even in a product-environment.
unsigned char sal_Bool
Definition: types.h:46
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
char sal_Char
Definition: types.h:124