|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: Header file for SfLogger to include macros needed to log information. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* |
|
20 --------------------------------------------------------------------------------------- |
|
21 FILE: |
|
22 SfLogger.h |
|
23 |
|
24 DESCRIPTION: |
|
25 DebugLogger. |
|
26 SfLogger includes a few macros that can be used to record information |
|
27 of interest to the user. Log file is stored to c:\Logs\BrowserTelService\. |
|
28 |
|
29 EXAMPLES: |
|
30 #ifdef __DEBUGLOGGER__ |
|
31 //Writes 'Some text' to the log |
|
32 WRITE_LOG(_L("Some text")); |
|
33 #endif __DEBUGLOGGER__ |
|
34 |
|
35 #ifdef __DEBUGLOGGER__ |
|
36 //Writes formated text to the log |
|
37 TInt num1=100; |
|
38 WRITE_LOG_FORMAT(_L("Writing a number to the log: %d"), num1); |
|
39 #endif __DEBUGLOGGER__ |
|
40 |
|
41 #ifdef __DEBUGLOGGER__ |
|
42 // Line begins with time only |
|
43 SET_LOG_DATE_TIME( EFalse, ETrue); |
|
44 #endif __DEBUGLOGGER__ |
|
45 |
|
46 #ifdef __DEBUGLOGGER__ |
|
47 WRITE_LOG(_L8("HexDump Test")); |
|
48 const TText* hdr=_S("123456"); |
|
49 const TText* mgn=_S(" "); |
|
50 const TUint8* ptr=_S8("abcdefghijklmnopqrstuxyz"); |
|
51 TInt len=26; |
|
52 LOG_HEX_DUMP(hdr,mgn,ptr,len); |
|
53 #endif __DEBUGLOGGER__ |
|
54 |
|
55 ---------------------------------------------------------------------------------------- |
|
56 */ |
|
57 |
|
58 #ifndef __SFLOGGER_H |
|
59 #define __SFLOGGER_H |
|
60 |
|
61 //#define __DEBUG_PRINT |
|
62 |
|
63 #ifdef __DEBUG_PRINT |
|
64 #include <flogger.h> |
|
65 |
|
66 // log files are stored to KDebugLogDirFull folder |
|
67 _LIT(KDebugLogDirFull,"C:\\Logs\\BrowserTelService\\"); |
|
68 |
|
69 _LIT(KDebugLogDir, "BrowserTelService"); |
|
70 _LIT(KDebugLogFileName, "DebugLog.txt"); |
|
71 _LIT(KDebugLogTitle, "- BrowserTelService Debug Log File -"); |
|
72 _LIT(KDebugLogCreated, "**Debug Log File Created**"); |
|
73 _LIT(KDebugLogClosed, "**Debug Log File Closed**"); |
|
74 _LIT(KFailed, "failed: leave code=%d"); |
|
75 |
|
76 #endif // __DEBUG_PRINT |
|
77 |
|
78 #ifdef __DEBUG_PRINT |
|
79 #define WRITE_LOG(AAA,BBB) AAA.Write(BBB) |
|
80 #else |
|
81 #define WRITE_LOG(AAA,BBB) |
|
82 #endif // __DEBUG_PRINT |
|
83 |
|
84 #ifdef __DEBUG_PRINT |
|
85 #define WRITE_LOG_FORMAT(AAA,BBB,CCC) AAA.WriteFormat(BBB,CCC) |
|
86 #else |
|
87 #define WRITE_LOG_FORMAT(AAA,BBB,CCC) |
|
88 #endif // __DEBUG_PRINT |
|
89 |
|
90 #ifdef __DEBUG_PRINT |
|
91 #define SET_LOG_DATE_TIME(AAA,BBB,CCC) AAA.SetDateAndTime(BBB,CCC) |
|
92 #else |
|
93 #define SET_LOG_DATE_TIME(AAA,BBB,CCC) |
|
94 #endif // __DEBUG_PRINT |
|
95 |
|
96 #ifdef __DEBUG_PRINT |
|
97 #define WRITE_ALLOCATED_SIZE(AAA,BBB) {TInt bytes; User::AllocSize(bytes); WRITE_LOG_FORMAT(AAA,KBytes,bytes,BBB);}; |
|
98 #else |
|
99 #define WRITE_ALLOCATED_SIZE() |
|
100 #endif // __DEBUG_PRINT |
|
101 |
|
102 #endif // __SFLOGGER_H |