|
1 /* |
|
2 * Copyright (c) 2009 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: This file contains the header file of the |
|
15 * CStifLoggerBase. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef STIFLOGGERBASE_H |
|
20 #define STIFLOGGERBASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <StifLogger.h> |
|
25 |
|
26 // CLASS DECLARATION |
|
27 |
|
28 // DESCRIPTION |
|
29 // CStifLoggerBase is a STIF Test Framework StifLogger class. |
|
30 // Class contains a file logging operations. |
|
31 |
|
32 class CStifLoggerBase |
|
33 :public CBase |
|
34 { |
|
35 |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 */ |
|
41 IMPORT_C static CStifLoggerBase* NewL( const TDesC& aTestPath, |
|
42 const TDesC& aTestFile, |
|
43 // Default logger type is .txt |
|
44 CStifLogger::TLoggerType aLoggerType = CStifLogger::ETxt, |
|
45 // By default output is file |
|
46 CStifLogger::TOutput aOutput = CStifLogger::EFile, |
|
47 // By default overwrite is used |
|
48 TBool aOverWrite = ETrue, |
|
49 // By default time stamp is used |
|
50 TBool aWithTimeStamp = ETrue, |
|
51 // By default line break is used |
|
52 TBool aWithLineBreak = ETrue, |
|
53 // By default even ranking is not |
|
54 // used |
|
55 TBool aWithEventRanking = EFalse, |
|
56 // By default thread id is added |
|
57 // after the log file |
|
58 TBool aThreadIdToLogFile = ETrue, |
|
59 // By default log directory will |
|
60 // not create |
|
61 TBool aCreateLogDir = EFalse, |
|
62 // Static logger implementation is |
|
63 // not yet permanent, may change |
|
64 TInt aStaticBufferSize = 0, |
|
65 // By default files are not written |
|
66 // in unicode format |
|
67 TBool aUnicode = EFalse, |
|
68 TInt aThreadId =0); |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CStifLoggerBase(); |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 /** |
|
77 * C++ default constructor. |
|
78 */ |
|
79 CStifLoggerBase(); |
|
80 |
|
81 /** |
|
82 * Log a 16 bit information to some storage e.g. text file. There is |
|
83 * also parameter to styling text information e.g. text color. |
|
84 */ |
|
85 IMPORT_C TInt Log( TInt aStyle, const TDesC& aLogInfo ); |
|
86 |
|
87 /** |
|
88 * Log a 8 bit information to some storage e.g. text file. There is |
|
89 * also parameter to styling text information e.g. text color. |
|
90 */ |
|
91 IMPORT_C TInt Log( TInt aStyle, const TDesC8& aLogInfo ); |
|
92 |
|
93 /** |
|
94 * Get creation result. |
|
95 */ |
|
96 IMPORT_C TInt CreationResult(); |
|
97 |
|
98 /** |
|
99 * Get output type. Valid only if CreationResult returns KErrNone. |
|
100 */ |
|
101 IMPORT_C CStifLogger::TOutput OutputType(); |
|
102 |
|
103 /** |
|
104 * Pure virtual. Send style information and data to the output module. |
|
105 * 16 bit. |
|
106 */ |
|
107 virtual TInt Send( TInt /*aStyle*/, const TDesC& /*aData*/ ) = 0; |
|
108 |
|
109 /** |
|
110 * Pure virtual. Send style information and data to the output module. |
|
111 * 8 bit. |
|
112 */ |
|
113 virtual TInt Send( TInt /*aStyle*/, const TDesC8& /*aData*/ ) = 0; |
|
114 |
|
115 /** |
|
116 * Log 16 bit _LIT information to some storage e.g. text file. |
|
117 */ |
|
118 template<TInt S> TInt Log( const TLitC<S>& aLogInfo ) |
|
119 { |
|
120 return Send( CStifLogger::ENoStyle, (TDesC&)aLogInfo ); |
|
121 }; |
|
122 |
|
123 /** |
|
124 * Log 8 bit _LIT information to some storage e.g. text file. |
|
125 */ |
|
126 template<TInt S> TInt Log( const TLitC8<S>& aLogInfo ) |
|
127 { |
|
128 return Send( CStifLogger::ENoStyle, (TDesC8&)aLogInfo ); |
|
129 }; |
|
130 |
|
131 /** |
|
132 * Log 16 bit _LIT information to some storage e.g. text file. There is |
|
133 * also parameter to styling text information e.g. text color. |
|
134 */ |
|
135 template<TInt S> TInt Log( TInt aStyle, const TLitC<S>& aLogInfo ) |
|
136 { |
|
137 return Send( aStyle, (TDesC&)aLogInfo ); |
|
138 }; |
|
139 |
|
140 /** |
|
141 * Log 8 bit _LIT information to some storage e.g. text file. There is |
|
142 * also parameter to styling text information e.g. text color. |
|
143 */ |
|
144 template<TInt S> TInt Log( TInt aStyle, const TLitC8<S>& aLogInfo ) |
|
145 { |
|
146 return Send( aStyle, (TDesC8&)aLogInfo ); |
|
147 }; |
|
148 |
|
149 protected: // Data |
|
150 /** |
|
151 * Output object. |
|
152 */ |
|
153 COutput* iOutput; |
|
154 }; |
|
155 |
|
156 #endif // STIFLOGGERBASE_H |
|
157 |
|
158 // End of File |