|
1 // Copyright (c) 1997-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef __FLOGMAN_H__ |
|
22 #define __FLOGMAN_H__ |
|
23 |
|
24 #include <f32file.h> |
|
25 #include <flogger.h> |
|
26 |
|
27 class CFileLogger; |
|
28 NONSHARABLE_CLASS(CFileLoggerManager) : public CBase |
|
29 /** |
|
30 @internalComponent |
|
31 */ |
|
32 { |
|
33 public: |
|
34 static CFileLoggerManager* NewL(); |
|
35 ~CFileLoggerManager(); |
|
36 // |
|
37 void FindOrCreateLogL(TLogFile& aLogFile); |
|
38 void CloseLog(const TLogFile& aLogFile); |
|
39 void WriteToLogL(const TLogFile& aLogFile, const TDesC8& aBuf); |
|
40 void DeleteLogger(CFileLogger* aLogger); |
|
41 private: |
|
42 CFileLoggerManager(); |
|
43 void ConstructL(); |
|
44 TInt FindLogger(const TLogFile& aLogFile) const; |
|
45 private: |
|
46 CArrayFixFlat<CFileLogger*> iLogger; |
|
47 RFs iFs; |
|
48 }; |
|
49 |
|
50 class CLoggerDeletionTimer; |
|
51 |
|
52 NONSHARABLE_CLASS(CFileLogger) : public CBase |
|
53 /** |
|
54 @publishedAll |
|
55 @deprecated becoming internal |
|
56 */ |
|
57 { |
|
58 public: |
|
59 static CFileLogger* NewL(CFileLoggerManager* aLoggerManager,TLogFile& aLogFile, RFs& aFs); |
|
60 ~CFileLogger(); |
|
61 void Close(); |
|
62 void WriteLogL(const TDesC8& aBuf); |
|
63 TBool StartDeletionTimer(); |
|
64 void CancelDeletionTimer(); |
|
65 void DeletionTimerExpired(); |
|
66 inline void IncrementAccessCount(); |
|
67 inline void DecrementAccessCount(); |
|
68 inline TInt AccessCount() const; |
|
69 inline TLogFile LogFile() const; |
|
70 inline TBool DeletionTimerActive() const; |
|
71 private: |
|
72 CFileLogger(CFileLoggerManager* aLoggerManager,TLogFile& aLogFile, RFs& aFs); |
|
73 void ConstructL(TLogFile& aLogFile); |
|
74 void GetFolderAndFileNameL(TFileName& aFolder,TFileName& aFilename) const; |
|
75 private: |
|
76 CLoggerDeletionTimer* iTimer; |
|
77 CFileLoggerManager* iLoggerManager; |
|
78 RFs iFs; |
|
79 RFile iFile; |
|
80 TLogFile iLogFile; |
|
81 TInt iAccessCount; |
|
82 }; |
|
83 |
|
84 NONSHARABLE_CLASS(CLoggerDeletionTimer) : public CTimer |
|
85 /** |
|
86 @internalComponent |
|
87 */ |
|
88 { |
|
89 public: |
|
90 static CLoggerDeletionTimer* NewL(CFileLogger* aLogger); |
|
91 ~CLoggerDeletionTimer(); |
|
92 protected: |
|
93 CLoggerDeletionTimer(CFileLogger* aLoggerManager); |
|
94 void RunL(); |
|
95 private: |
|
96 CFileLogger* iLogger; |
|
97 }; |
|
98 |
|
99 #include "FLOGMAN.INL" |
|
100 |
|
101 #endif |
|
102 |