1 | /* $Id: tstLog.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT Testcase - Log Formatting.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | *
|
---|
26 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
27 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
28 | * additional information or have any questions.
|
---|
29 | */
|
---|
30 |
|
---|
31 | /*******************************************************************************
|
---|
32 | * Header Files *
|
---|
33 | *******************************************************************************/
|
---|
34 | #include <iprt/log.h>
|
---|
35 | #include <iprt/runtime.h>
|
---|
36 | #include <iprt/err.h>
|
---|
37 |
|
---|
38 | #include <stdio.h>
|
---|
39 |
|
---|
40 | int main()
|
---|
41 | {
|
---|
42 | RTR3Init();
|
---|
43 | printf("tstLog: Requires manual inspection of the log output!\n");
|
---|
44 | RTLogPrintf("%%Vrc %d: %Vrc\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
45 | RTLogPrintf("%%Vrs %d: %Vrs\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
46 | RTLogPrintf("%%Vrf %d: %Vrf\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
47 | RTLogPrintf("%%Vra %d: %Vra\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
|
---|
48 |
|
---|
49 | RTLogPrintf("%%Vt: %Vt\n");
|
---|
50 |
|
---|
51 | static uint8_t au8Hex[256];
|
---|
52 | for (unsigned iHex = 0; iHex < sizeof(au8Hex); iHex++)
|
---|
53 | au8Hex[iHex] = (uint8_t)iHex;
|
---|
54 | RTLogPrintf("%%Vhxs : %Vhxs\n", &au8Hex[0]);
|
---|
55 | RTLogPrintf("%%.32Vhxs: %.32Vhxs\n", &au8Hex[0]);
|
---|
56 |
|
---|
57 | RTLogPrintf("%%Vhxd :\n%Vhxd\n", &au8Hex[0]);
|
---|
58 | RTLogPrintf("%%.64Vhxd:\n%.64Vhxd\n", &au8Hex[0]);
|
---|
59 | RTLogPrintf("%%.*Vhxd:\n%.*Vhxd\n", 64, &au8Hex[0]);
|
---|
60 | RTLogPrintf("%%32.256Vhxd : \n%32.256Vhxd\n", &au8Hex[0]);
|
---|
61 | RTLogPrintf("%%32.*Vhxd : \n%32.*Vhxd\n", 256, &au8Hex[0]);
|
---|
62 | RTLogPrintf("%%7.32Vhxd : \n%7.32Vhxd\n", &au8Hex[0]);
|
---|
63 | RTLogPrintf("%%7.*Vhxd : \n%7.*Vhxd\n", 32, &au8Hex[0]);
|
---|
64 | RTLogPrintf("%%*.*Vhxd : \n%*.*Vhxd\n", 7, 32, &au8Hex[0]);
|
---|
65 |
|
---|
66 | RTLogPrintf("%%VGp: %VGp\n", (RTGCPHYS)0x87654321);
|
---|
67 | RTLogPrintf("%%VGv: %VGv\n", (RTGCPTR)0x87654321);
|
---|
68 | RTLogPrintf("%%VHp: %VHp\n", (RTGCPHYS)0x87654321);
|
---|
69 | RTLogPrintf("%%VHv: %VHv\n", (RTGCPTR)0x87654321);
|
---|
70 |
|
---|
71 | RTLogPrintf("%%VI8 : %VI8\n", (uint8_t)808);
|
---|
72 | RTLogPrintf("%%VI16: %VI16\n", (uint16_t)16016);
|
---|
73 | RTLogPrintf("%%VI32: %VI32\n", _1G);
|
---|
74 | RTLogPrintf("%%VI64: %VI64\n", _1E);
|
---|
75 |
|
---|
76 | RTLogPrintf("%%VU8 : %VU8\n", (uint8_t)808);
|
---|
77 | RTLogPrintf("%%VU16: %VU16\n", (uint16_t)16016);
|
---|
78 | RTLogPrintf("%%VU32: %VU32\n", _2G32);
|
---|
79 | RTLogPrintf("%%VU64: %VU64\n", _2E);
|
---|
80 |
|
---|
81 | RTLogPrintf("%%VX8 : %VX8 %#VX8\n", (uint8_t)808, (uint8_t)808);
|
---|
82 | RTLogPrintf("%%VX16: %VX16 %#VX16\n", (uint16_t)16016, (uint16_t)16016);
|
---|
83 | RTLogPrintf("%%VX32: %VX32 %#VX32\n", _2G32, _2G32);
|
---|
84 | RTLogPrintf("%%VX64: %VX64 %#VX64\n", _2E, _2E);
|
---|
85 |
|
---|
86 | RTLogFlush(NULL);
|
---|
87 |
|
---|
88 | return 0;
|
---|
89 | }
|
---|
90 |
|
---|