js/xpconnect/src/XPCLog.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial