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 "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: LandmarksUi Content File - Contains debugging functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "Debug.h" |
|
22 #include <flogger.h> |
|
23 #include <e32svr.h> |
|
24 |
|
25 #ifdef __LMK_DEBUG_FLAG |
|
26 |
|
27 // CONSTANTS |
|
28 #ifdef _DEBUG |
|
29 /// Folder where the log resides |
|
30 _LIT( KLogFolder, "Lmk" ); |
|
31 |
|
32 /// The name of the log file |
|
33 _LIT( KLogFileName, "Lmk" ); |
|
34 |
|
35 /// The format in which the time is formatted in log |
|
36 _LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); |
|
37 |
|
38 /// The length of the string produced by KLocLogTimeFormat |
|
39 const TInt KLogTimeFormatLength = 16; |
|
40 |
|
41 /// How many characters a log line can contain |
|
42 const TInt KLogLineLength = 256; |
|
43 #endif |
|
44 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
45 |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // Debug |
|
49 // Generates a log file if c:\logs\LMK\ folder exists |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void Debug( TRefByValue<const TDesC> aText, ... ) |
|
53 { |
|
54 #ifdef _DEBUG |
|
55 RDebug::Print(aText); |
|
56 |
|
57 VA_LIST args; |
|
58 VA_START( args, aText ); |
|
59 |
|
60 TBuf<KLogLineLength> buf; |
|
61 buf.FormatList( aText, args ); |
|
62 |
|
63 RFileLogger logger; |
|
64 TInt ret=logger.Connect(); |
|
65 if (ret==KErrNone) |
|
66 { |
|
67 logger.SetDateAndTime( EFalse,EFalse ); |
|
68 logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); |
|
69 TBuf<KLogTimeFormatLength> timeStamp; |
|
70 TTime now; |
|
71 now.HomeTime(); |
|
72 TDateTime dateTime; |
|
73 dateTime = now.DateTime(); |
|
74 timeStamp.Format( KLogTimeFormat, |
|
75 dateTime.Hour(), dateTime.Minute(), |
|
76 dateTime.Second(), dateTime.MicroSecond() ); |
|
77 buf.Insert( 0, timeStamp ); |
|
78 |
|
79 logger.Write(buf); |
|
80 } |
|
81 |
|
82 logger.Close(); |
|
83 |
|
84 VA_END( args ); |
|
85 #endif |
|
86 } |
|
87 |
|
88 #endif // __LMK_DEBUG_FLAG |
|
89 |
|
90 // End of File |
|