1 | /******************************Module*Header*******************************\
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
4 | *
|
---|
5 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
6 | * available from http://www.virtualbox.org. This file is free software;
|
---|
7 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
8 | * General Public License (GPL) as published by the Free Software
|
---|
9 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
10 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
11 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
12 | *
|
---|
13 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
14 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
15 | * additional information or have any questions.
|
---|
16 | */
|
---|
17 | /*
|
---|
18 | * Based in part on Microsoft DDK sample code
|
---|
19 | *
|
---|
20 | * *******************
|
---|
21 | * * GDI SAMPLE CODE *
|
---|
22 | * *******************
|
---|
23 | *
|
---|
24 | * Module Name: debug.c
|
---|
25 | *
|
---|
26 | * debug helpers routine
|
---|
27 | *
|
---|
28 | * Copyright (c) 1992-1998 Microsoft Corporation
|
---|
29 | *
|
---|
30 | \**************************************************************************/
|
---|
31 |
|
---|
32 | #include "driver.h"
|
---|
33 |
|
---|
34 | #ifdef VBOX
|
---|
35 | #include <VBox/log.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | ULONG DebugLevel = 0;
|
---|
39 |
|
---|
40 | /*****************************************************************************
|
---|
41 | *
|
---|
42 | * Routine Description:
|
---|
43 | *
|
---|
44 | * This function is variable-argument, level-sensitive debug print
|
---|
45 | * routine.
|
---|
46 | * If the specified debug level for the print statement is lower or equal
|
---|
47 | * to the current debug level, the message will be printed.
|
---|
48 | *
|
---|
49 | * Arguments:
|
---|
50 | *
|
---|
51 | * DebugPrintLevel - Specifies at which debugging level the string should
|
---|
52 | * be printed
|
---|
53 | *
|
---|
54 | * DebugMessage - Variable argument ascii c string
|
---|
55 | *
|
---|
56 | * Return Value:
|
---|
57 | *
|
---|
58 | * None.
|
---|
59 | *
|
---|
60 | ***************************************************************************/
|
---|
61 |
|
---|
62 | VOID
|
---|
63 | DebugPrint(
|
---|
64 | ULONG DebugPrintLevel,
|
---|
65 | PCHAR DebugMessage,
|
---|
66 | ...
|
---|
67 | )
|
---|
68 |
|
---|
69 | {
|
---|
70 |
|
---|
71 | va_list ap;
|
---|
72 |
|
---|
73 | va_start(ap, DebugMessage);
|
---|
74 |
|
---|
75 | #ifdef VBOX
|
---|
76 | RTLogBackdoorPrintf("MIRROR: ");
|
---|
77 | RTLogBackdoorPrintfV(DebugMessage, ap);
|
---|
78 | #else
|
---|
79 | if (DebugPrintLevel <= DebugLevel)
|
---|
80 | {
|
---|
81 | EngDebugPrint("", DebugMessage, ap);
|
---|
82 | }
|
---|
83 | #endif /* VBOX */
|
---|
84 |
|
---|
85 | va_end(ap);
|
---|
86 |
|
---|
87 | }
|
---|
88 |
|
---|