js/xpconnect/src/XPCLog.h

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:ab187987e09d
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set ts=8 sts=4 et sw=4 tw=99: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 /* Debug Logging support. */
8
9 #ifndef xpclog_h___
10 #define xpclog_h___
11
12 #include "prlog.h"
13
14 /*
15 * This uses prlog.h See prlog.h for environment settings for output.
16 * The module name used here is 'xpclog'. These environment settings
17 * should work...
18 *
19 * SET NSPR_LOG_MODULES=xpclog:5
20 * SET NSPR_LOG_FILE=logfile.txt
21 *
22 * usage:
23 * XPC_LOG_ERROR(("my comment number %d", 5)) // note the double parens
24 *
25 */
26
27 #ifdef DEBUG
28 #define XPC_LOG_INTERNAL(number,_args) \
29 do{if (XPC_Log_Check(number)){XPC_Log_print _args;}}while (0)
30
31 #define XPC_LOG_ALWAYS(_args) XPC_LOG_INTERNAL(1,_args)
32 #define XPC_LOG_ERROR(_args) XPC_LOG_INTERNAL(2,_args)
33 #define XPC_LOG_WARNING(_args) XPC_LOG_INTERNAL(3,_args)
34 #define XPC_LOG_DEBUG(_args) XPC_LOG_INTERNAL(4,_args)
35 #define XPC_LOG_FLUSH() PR_LogFlush()
36 #define XPC_LOG_INDENT() XPC_Log_Indent()
37 #define XPC_LOG_OUTDENT() XPC_Log_Outdent()
38 #define XPC_LOG_CLEAR_INDENT() XPC_Log_Clear_Indent()
39 #define XPC_LOG_FINISH() XPC_Log_Finish()
40
41 extern "C" {
42
43 void XPC_Log_print(const char *fmt, ...);
44 bool XPC_Log_Check(int i);
45 void XPC_Log_Indent();
46 void XPC_Log_Outdent();
47 void XPC_Log_Clear_Indent();
48 void XPC_Log_Finish();
49
50 } // extern "C"
51
52 #else
53
54 #define XPC_LOG_ALWAYS(_args) ((void)0)
55 #define XPC_LOG_ERROR(_args) ((void)0)
56 #define XPC_LOG_WARNING(_args) ((void)0)
57 #define XPC_LOG_DEBUG(_args) ((void)0)
58 #define XPC_LOG_FLUSH() ((void)0)
59 #define XPC_LOG_INDENT() ((void)0)
60 #define XPC_LOG_OUTDENT() ((void)0)
61 #define XPC_LOG_CLEAR_INDENT() ((void)0)
62 #define XPC_LOG_FINISH() ((void)0)
63 #endif
64
65 #endif /* xpclog_h___ */

mercurial