1 | /******************************Module*Header*******************************\
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
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 | /*
|
---|
14 | * Based in part on Microsoft DDK sample code
|
---|
15 | *
|
---|
16 | * *******************
|
---|
17 | * * GDI SAMPLE CODE *
|
---|
18 | * *******************
|
---|
19 | *
|
---|
20 | * Module Name: debug.c
|
---|
21 | *
|
---|
22 | * debug helpers routine
|
---|
23 | *
|
---|
24 | * Copyright (c) 1992-1998 Microsoft Corporation
|
---|
25 | *
|
---|
26 | \**************************************************************************/
|
---|
27 |
|
---|
28 | #include "driver.h"
|
---|
29 |
|
---|
30 | #ifdef VBOX
|
---|
31 | #include <VBox/log.h>
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | ULONG DebugLevel = 0;
|
---|
35 |
|
---|
36 | /*****************************************************************************
|
---|
37 | *
|
---|
38 | * Routine Description:
|
---|
39 | *
|
---|
40 | * This function is variable-argument, level-sensitive debug print
|
---|
41 | * routine.
|
---|
42 | * If the specified debug level for the print statement is lower or equal
|
---|
43 | * to the current debug level, the message will be printed.
|
---|
44 | *
|
---|
45 | * Arguments:
|
---|
46 | *
|
---|
47 | * DebugPrintLevel - Specifies at which debugging level the string should
|
---|
48 | * be printed
|
---|
49 | *
|
---|
50 | * DebugMessage - Variable argument ascii c string
|
---|
51 | *
|
---|
52 | * Return Value:
|
---|
53 | *
|
---|
54 | * None.
|
---|
55 | *
|
---|
56 | ***************************************************************************/
|
---|
57 |
|
---|
58 | VOID
|
---|
59 | DebugPrint(
|
---|
60 | ULONG DebugPrintLevel,
|
---|
61 | PCHAR DebugMessage,
|
---|
62 | ...
|
---|
63 | )
|
---|
64 |
|
---|
65 | {
|
---|
66 |
|
---|
67 | va_list ap;
|
---|
68 |
|
---|
69 | va_start(ap, DebugMessage);
|
---|
70 |
|
---|
71 | #ifdef VBOX
|
---|
72 | RTLogBackdoorPrintf("MIRROR: ");
|
---|
73 | RTLogBackdoorPrintfV(DebugMessage, ap);
|
---|
74 | #else
|
---|
75 | if (DebugPrintLevel <= DebugLevel)
|
---|
76 | {
|
---|
77 | EngDebugPrint("", DebugMessage, ap);
|
---|
78 | }
|
---|
79 | #endif /* VBOX */
|
---|
80 |
|
---|
81 | va_end(ap);
|
---|
82 |
|
---|
83 | }
|
---|
84 |
|
---|