|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // LOGSERVERCLI.H |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __LOGSERVERCLI_H__ |
|
19 #define __LOGSERVERCLI_H__ |
|
20 |
|
21 // System includes |
|
22 #include <e32std.h> |
|
23 |
|
24 // User includes |
|
25 #include <logcli.h> |
|
26 #include "LogCliServShared.h" |
|
27 |
|
28 class RLogSession : public RSessionBase |
|
29 /** |
|
30 @internalComponent |
|
31 */ |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Constructor |
|
36 */ |
|
37 RLogSession(); |
|
38 |
|
39 /** |
|
40 * Connect to Log Server |
|
41 */ |
|
42 TInt Connect(); |
|
43 |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Asynchronous send to server. Reply received via aStatus |
|
48 */ |
|
49 void Send(TInt aType, const TIpcArgs& aArgs, TRequestStatus& aStatus) const; |
|
50 |
|
51 /** |
|
52 * Synchronous send to server. Reply returned to caller |
|
53 */ |
|
54 TInt Send(TInt aType, const TIpcArgs& aArgs) const; |
|
55 |
|
56 /** |
|
57 * Get the next free operation id |
|
58 */ |
|
59 inline TLogOperationId AllocateIdOperation(); |
|
60 |
|
61 /** |
|
62 * Get the next free view id |
|
63 */ |
|
64 inline TLogViewId AllocateIdView(); |
|
65 |
|
66 private: |
|
67 TInt SendWithRetry(TInt aType, const TIpcArgs& aParam) const; |
|
68 void SendWithRetryAsync(TInt aType, const TIpcArgs& aParam, TRequestStatus& aStatus) const; |
|
69 |
|
70 private: |
|
71 TLogOperationId iOperationId; |
|
72 TLogViewId iViewId; |
|
73 }; |
|
74 |
|
75 |
|
76 inline TLogOperationId RLogSession::AllocateIdOperation() |
|
77 { |
|
78 return iOperationId++; |
|
79 } |
|
80 |
|
81 inline TLogViewId RLogSession::AllocateIdView() |
|
82 { |
|
83 return iViewId++; |
|
84 } |
|
85 |
|
86 |
|
87 #ifdef LOGGING_ENABLED |
|
88 |
|
89 #include <f32file.h> |
|
90 #include <flogger.h> |
|
91 |
|
92 /** |
|
93 @internalComponent |
|
94 */ |
|
95 _LIT(KLogFileName, "LogEng.txt"); |
|
96 _LIT(KLogFolder, "LogEng"); |
|
97 _LIT(KTimeFormat, "%02d.%02d:%02d:%06d "); |
|
98 _LIT(KTextFormat, "%S"); |
|
99 |
|
100 class Log : public RFileLogger |
|
101 /** |
|
102 @internalComponent |
|
103 */ |
|
104 { |
|
105 public: |
|
106 static void New(); |
|
107 static void Write(const TDesC& aText); |
|
108 static void WriteFormat(TRefByValue<const TDesC> aFmt, ...); |
|
109 |
|
110 private: |
|
111 static void PruneLogFile(); |
|
112 }; |
|
113 |
|
114 /** |
|
115 @internalComponent |
|
116 */ |
|
117 #define LOGNEW Log::New() |
|
118 #define LOGTEXT(AAA) { _LIT(KString, AAA); Log::Write(KString); } |
|
119 #define LOGTEXT2(AAA, BBB) { _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB); } |
|
120 #define LOGTEXT3(AAA, BBB, CCC) { _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB, CCC); } |
|
121 #define LOGTEXT4(AAA, BBB, CCC, DDD) { _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB, CCC, DDD); } |
|
122 |
|
123 #else |
|
124 |
|
125 #define LOGNEW |
|
126 #define LOGTEXT(AAA) |
|
127 #define LOGTEXT2(AAA, BBB) |
|
128 #define LOGTEXT3(AAA, BBB, CCC) |
|
129 #define LOGTEXT4(AAA, BBB, CCC, DDD) |
|
130 |
|
131 #endif |
|
132 |
|
133 |
|
134 #endif |
|
135 |