VirtualBox

source: vbox/trunk/src/VBox/Main/include/Logging.h@ 28787

最後變更 在這個檔案從28787是 28401,由 vboxsync 提交於 15 年 前

Main/Machine+Snapshot+Medium: Big medium locking cleanup and straightened up the responsibilities between Snapshot and Medium. Rewritten task handling and cleaned up task implementation for medium operations. Implemented IMedium::mergeTo (no way to call it via any frontend yet), making the method parameters similar to IMedium::cloneto. Plus lots of other minor cleanups.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.6 KB
 
1/* $Id: Logging.h 28401 2010-04-16 09:14:54Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM: logging macros and function definitions
6 */
7
8/*
9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.alldomusa.eu.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_LOGGING
25#define ____H_LOGGING
26
27/** @def LOG_GROUP_MAIN_OVERRIDE
28 * Define this macro to point to the desired log group before including
29 * the |Logging.h| header if you want to use a group other than LOG_GROUP_MAIN
30 * for logging from within Main source files.
31 *
32 * @example #define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_HGCM
33 */
34
35/*
36 * We might be including the VBox logging subsystem before
37 * including this header file, so reset the logging group.
38 */
39#ifdef LOG_GROUP
40# undef LOG_GROUP
41#endif
42#ifdef LOG_GROUP_MAIN_OVERRIDE
43# define LOG_GROUP LOG_GROUP_MAIN_OVERRIDE
44#else
45# define LOG_GROUP LOG_GROUP_MAIN
46#endif
47
48/* Ensure log macros are enabled if release logging is requested */
49#if defined (VBOX_MAIN_RELEASE_LOG) && !defined (DEBUG)
50# ifndef LOG_ENABLED
51# define LOG_ENABLED
52# endif
53#endif
54
55#include <VBox/log.h>
56#include <iprt/assert.h>
57
58/** @def MyLogIt
59 * Copy of LogIt that works even when logging is completely disabled (e.g. in
60 * release builds) and doesn't interefere with the default release logger
61 * instance (which is already in use by the VM process).
62 *
63 * @warning Logging using MyLog* is intended only as a temporary mean to debug
64 * release builds (e.g. in case if the error is not reproducible with
65 * the debug builds)! Any MyLog* usage must be removed from the sources
66 * after the error has been fixed.
67 */
68#if defined(RT_ARCH_AMD64) || defined(LOG_USE_C99)
69# define _MyLogRemoveParentheseis(...) __VA_ARGS__
70# define _MyLogIt(pvInst, fFlags, iGroup, ...) RTLogLoggerEx((PRTLOGGER)pvInst, fFlags, iGroup, __VA_ARGS__)
71# define MyLogIt(pvInst, fFlags, iGroup, fmtargs) _MyLogIt(pvInst, fFlags, iGroup, _MyLogRemoveParentheseis fmtargs)
72#else
73# define MyLogIt(pvInst, fFlags, iGroup, fmtargs) \
74 do \
75 { \
76 register PRTLOGGER LogIt_pLogger = (PRTLOGGER)(pvInst) ? (PRTLOGGER)(pvInst) : RTLogDefaultInstance(); \
77 if (LogIt_pLogger) \
78 { \
79 register unsigned LogIt_fFlags = LogIt_pLogger->afGroups[(unsigned)(iGroup) < LogIt_pLogger->cGroups ? (unsigned)(iGroup) : 0]; \
80 if ((LogIt_fFlags & ((fFlags) | RTLOGGRPFLAGS_ENABLED)) == ((fFlags) | RTLOGGRPFLAGS_ENABLED)) \
81 LogIt_pLogger->pfnLogger fmtargs; \
82 } \
83 } while (0)
84#endif
85
86/** @def MyLog
87 * Equivalent to LogFlow but uses MyLogIt instead of LogIt.
88 *
89 * @warning Logging using MyLog* is intended only as a temporary mean to debug
90 * release builds (e.g. in case if the error is not reproducible with
91 * the debug builds)! Any MyLog* usage must be removed from the sources
92 * after the error has been fixed.
93 */
94#define MyLog(a) MyLogIt(LOG_INSTANCE, RTLOGGRPFLAGS_FLOW, LOG_GROUP, a)
95
96#endif // ____H_LOGGING
97/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette