sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __FLOGMAN_H__ sl@0: #define __FLOGMAN_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: class CFileLogger; sl@0: NONSHARABLE_CLASS(CFileLoggerManager) : public CBase sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: public: sl@0: static CFileLoggerManager* NewL(); sl@0: ~CFileLoggerManager(); sl@0: // sl@0: void FindOrCreateLogL(TLogFile& aLogFile); sl@0: void CloseLog(const TLogFile& aLogFile); sl@0: void WriteToLogL(const TLogFile& aLogFile, const TDesC8& aBuf); sl@0: void DeleteLogger(CFileLogger* aLogger); sl@0: private: sl@0: CFileLoggerManager(); sl@0: void ConstructL(); sl@0: TInt FindLogger(const TLogFile& aLogFile) const; sl@0: private: sl@0: CArrayFixFlat iLogger; sl@0: RFs iFs; sl@0: }; sl@0: sl@0: class CLoggerDeletionTimer; sl@0: sl@0: NONSHARABLE_CLASS(CFileLogger) : public CBase sl@0: /** sl@0: @publishedAll sl@0: @deprecated becoming internal sl@0: */ sl@0: { sl@0: public: sl@0: static CFileLogger* NewL(CFileLoggerManager* aLoggerManager,TLogFile& aLogFile, RFs& aFs); sl@0: ~CFileLogger(); sl@0: void Close(); sl@0: void WriteLogL(const TDesC8& aBuf); sl@0: TBool StartDeletionTimer(); sl@0: void CancelDeletionTimer(); sl@0: void DeletionTimerExpired(); sl@0: inline void IncrementAccessCount(); sl@0: inline void DecrementAccessCount(); sl@0: inline TInt AccessCount() const; sl@0: inline TLogFile LogFile() const; sl@0: inline TBool DeletionTimerActive() const; sl@0: private: sl@0: CFileLogger(CFileLoggerManager* aLoggerManager,TLogFile& aLogFile, RFs& aFs); sl@0: void ConstructL(TLogFile& aLogFile); sl@0: void GetFolderAndFileNameL(TFileName& aFolder,TFileName& aFilename) const; sl@0: private: sl@0: CLoggerDeletionTimer* iTimer; sl@0: CFileLoggerManager* iLoggerManager; sl@0: RFs iFs; sl@0: RFile iFile; sl@0: TLogFile iLogFile; sl@0: TInt iAccessCount; sl@0: }; sl@0: sl@0: NONSHARABLE_CLASS(CLoggerDeletionTimer) : public CTimer sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: public: sl@0: static CLoggerDeletionTimer* NewL(CFileLogger* aLogger); sl@0: ~CLoggerDeletionTimer(); sl@0: protected: sl@0: CLoggerDeletionTimer(CFileLogger* aLoggerManager); sl@0: void RunL(); sl@0: private: sl@0: CFileLogger* iLogger; sl@0: }; sl@0: sl@0: #include "FLOGMAN.INL" sl@0: sl@0: #endif sl@0: