sl@0: // Copyright (c) 2004-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: #ifndef __SCHLOGGER_H__ sl@0: #define __SCHLOGGER_H__ sl@0: sl@0: #ifdef __SCHLOGGING__ sl@0: #pragma message(__FILE__ ": (15) WARNING! Schedule logging is enabled") sl@0: sl@0: // System includes sl@0: #include sl@0: sl@0: /** sl@0: Literal constants sl@0: @internalComponent sl@0: */ sl@0: _LIT(KSchSvrLogFile, "SCHSVR.TXT"); sl@0: _LIT(KSchSvrLogFolder, "SCHSVR"); sl@0: sl@0: // sl@0: // ------> CSheduleServerLog (header) sl@0: // sl@0: class CSheduleServerLog : public CBase sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: // sl@0: public: // CONSTRUCT / DESTRUCT sl@0: // sl@0: static CSheduleServerLog* NewL(const TDesC& aLogFileName); sl@0: ~CSheduleServerLog(); sl@0: sl@0: // sl@0: private: // INTERNAL CONSTRUCT sl@0: // sl@0: CSheduleServerLog(); sl@0: void ConstructL(const TDesC& aLogFileName); sl@0: sl@0: // sl@0: public: // ACCESS sl@0: // sl@0: void Log(TRefByValue aFmt,...); sl@0: void LogList(TRefByValue aFmt, VA_LIST aList); sl@0: void SeekEnd(); sl@0: sl@0: // sl@0: private: // INTERNAL sl@0: // sl@0: void Write(const TDesC& aText); sl@0: void Write(const TDesC& aFmt, VA_LIST& aList); sl@0: void WriteWithTimeStamp(const TDesC& aText); sl@0: void NewLine(); sl@0: sl@0: // sl@0: private: // MEMBER DATA sl@0: // sl@0: RFs iFs; sl@0: RFile iFile; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines sl@0: @internalComponent sl@0: */ sl@0: #define LOGSTRING(AAA) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(tempLogDes()); } sl@0: #define LOGSTRING2(AAA,BBB) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB); } sl@0: #define LOGSTRING3(AAA,BBB,CCC) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC); } sl@0: #define LOGSTRING4(AAA,BBB,CCC,DDD) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD); } sl@0: #define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD,EEE); } sl@0: #define LOGSTRING6(AAA,BBB,CCC,DDD,EEE,FFF) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD,EEE,FFF); } sl@0: #define LOGSTRING7(AAA,BBB,CCC,DDD,EEE,FFF,GGG) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG); } sl@0: #define LOGSTRING8(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH); } sl@0: #define LOGSTRING9(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH,III); } sl@0: #define LOGSTRING10(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III, JJJ) \ sl@0: { _LIT(tempLogDes, AAA); reinterpret_cast(Dll::Tls())->Log(TRefByValue(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH,III,JJJ); } sl@0: sl@0: sl@0: #else sl@0: sl@0: // Defines sl@0: #define LOGSTRING(AAA) sl@0: #define LOGSTRING2(AAA,BBB) sl@0: #define LOGSTRING3(AAA,BBB,CCC) sl@0: #define LOGSTRING4(AAA,BBB,CCC,DDD) sl@0: #define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) sl@0: #define LOGSTRING6(AAA,BBB,CCC,DDD,EEE,FFF) sl@0: #define LOGSTRING7(AAA,BBB,CCC,DDD,EEE,FFF,GGG) sl@0: #define LOGSTRING8(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH) sl@0: #define LOGSTRING9(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III) sl@0: #define LOGSTRING10(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III, JJJ) sl@0: sl@0: #endif sl@0: sl@0: #endif