1 /* |
|
2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Debug printing to a log file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MDEBUG_H |
|
20 #define MDEBUG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 |
|
25 #include "mydebug.h" |
|
26 |
|
27 // Take care that the correct mydebug.h will be included |
|
28 // In mydebug.h in your module inc directory, |
|
29 // define your application-specific configuration like this: |
|
30 // ---------------------------------------------------------- |
|
31 // Debug file - debug output is disabled if the parent dir does not exist |
|
32 // _LIT(KDebugFileName, "C:\\logs\\remotefileengine\\remotefileengine.txt"); |
|
33 |
|
34 // Replace the current debug file - if not defined appends to the file |
|
35 #ifndef APPEND_TO_DEBUG_FILE |
|
36 #define REPLACE_DEBUG_FILE |
|
37 #endif |
|
38 |
|
39 // Maximum formatted size resulting from a single DEBUG* call |
|
40 #ifndef MAX_DEBUG_STRING_LENGTH |
|
41 #define MAX_DEBUG_STRING_LENGTH 4096 |
|
42 #endif |
|
43 // ---------------------------------------------------------- |
|
44 |
|
45 // FUNCTION PROTOTYPES |
|
46 void DebugInit(TBool aDebugSuspended = EFalse); |
|
47 void SetDebugEnabled(TBool aValue); |
|
48 void SetDebugSuspended(TBool aValue); |
|
49 void DebugStringNarrowL(const char* aFmt, ...); |
|
50 void DebugStringWideL(const char* aFmt, ...); |
|
51 void DebugBufferL(const TDesC8& aBuf); |
|
52 void DebugBufferL(const TDesC& aBuf); |
|
53 void DebugTimeL(const TTime& aTime); |
|
54 |
|
55 // MACROS |
|
56 // If you output one or more narrow descriptors by using '%S', |
|
57 // use DEBUGSTRING8 |
|
58 // else if you output one or more unicode descriptors by using '%S', |
|
59 // use DEBUGSTRING16 |
|
60 // else |
|
61 // use DEBUGSTRING |
|
62 // |
|
63 // Narrow and unicode cannot be mixed in a single DEBUGSTRINGx call. |
|
64 |
|
65 #ifdef _DEBUG |
|
66 #define DEBUGINIT() DebugInit() |
|
67 #define DEBUGINITSUSPENDED() DebugInit(ETrue) |
|
68 #define DEBUGENABLE() SetDebugEnabled(ETrue) |
|
69 #define DEBUGDISABLE() SetDebugEnabled(EFalse) |
|
70 #define DEBUGSUSPEND() SetDebugSuspended(ETrue) |
|
71 #define DEBUGCONTINUE() SetDebugSuspended(EFalse) |
|
72 #define DEBUGSTRING(x) DebugStringNarrowL x |
|
73 #define DEBUGSTRING8(x) DebugStringNarrowL x |
|
74 #define DEBUGSTRING16(x) DebugStringWideL x |
|
75 #define DEBUGBUFFER(x) DebugBufferL x |
|
76 #define DEBUGTIME(x) DebugTimeL x |
|
77 #else |
|
78 #define DEBUGINIT() |
|
79 #define DEBUGINITSUSPENDED() |
|
80 #define DEBUGENABLE() |
|
81 #define DEBUGDISABLE() |
|
82 #define DEBUGSUSPEND() |
|
83 #define DEBUGCONTINUE() |
|
84 #define DEBUGSTRING(x) |
|
85 #define DEBUGSTRING8(x) |
|
86 #define DEBUGSTRING16(x) |
|
87 #define DEBUGBUFFER(x) |
|
88 #define DEBUGTIME(x) |
|
89 #endif |
|
90 |
|
91 #endif // MDEBUG_H |
|
92 |
|
93 // End of File |
|