os/ossrv/genericservices/taskscheduler/SCHSVR/SchLogger.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 #ifndef __SCHLOGGER_H__
    17 #define __SCHLOGGER_H__
    18 
    19 #ifdef __SCHLOGGING__
    20 	#pragma message(__FILE__ ": (15) WARNING! Schedule logging is enabled")
    21 	
    22 	// System includes
    23 	#include <f32file.h>
    24 	
    25 	/** 
    26 	Literal constants
    27 	@internalComponent
    28 	*/
    29 	_LIT(KSchSvrLogFile,	"SCHSVR.TXT");
    30 	_LIT(KSchSvrLogFolder,	"SCHSVR");
    31 
    32 	//
    33 	// ------> CSheduleServerLog (header)
    34 	//
    35 	class CSheduleServerLog : public CBase
    36 	/** 
    37 	@internalComponent
    38 	*/
    39 		{
    40 	//
    41 	public: // CONSTRUCT / DESTRUCT
    42 	//
    43 		static CSheduleServerLog* NewL(const TDesC& aLogFileName);
    44 		~CSheduleServerLog();
    45 
    46 	//
    47 	private: // INTERNAL CONSTRUCT
    48 	//
    49 		CSheduleServerLog();
    50 		void ConstructL(const TDesC& aLogFileName);
    51 
    52 	//
    53 	public: // ACCESS
    54 	//
    55 		void Log(TRefByValue<const TDesC> aFmt,...);
    56 		void LogList(TRefByValue<const TDesC> aFmt, VA_LIST aList);
    57 		void SeekEnd();
    58 
    59 	//
    60 	private: // INTERNAL
    61 	//
    62 		void Write(const TDesC& aText);
    63 		void Write(const TDesC& aFmt, VA_LIST& aList);
    64 		void WriteWithTimeStamp(const TDesC& aText);
    65 		void NewLine();
    66 
    67 	//
    68 	private: // MEMBER DATA
    69 	//
    70 		RFs iFs;
    71 		RFile iFile;
    72 	};
    73 
    74 
    75 	/** 
    76 	Defines
    77 	@internalComponent
    78 	*/
    79 	#define LOGSTRING(AAA) \
    80 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(tempLogDes()); }
    81 	#define LOGSTRING2(AAA,BBB) \
    82 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB); }
    83 	#define LOGSTRING3(AAA,BBB,CCC) \
    84 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); }
    85 	#define LOGSTRING4(AAA,BBB,CCC,DDD) \
    86 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD); }
    87 	#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) \
    88 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE); }
    89 	#define LOGSTRING6(AAA,BBB,CCC,DDD,EEE,FFF) \
    90 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF); }
    91 	#define LOGSTRING7(AAA,BBB,CCC,DDD,EEE,FFF,GGG) \
    92 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG); }
    93 	#define LOGSTRING8(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH) \
    94 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH); }
    95 	#define LOGSTRING9(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III) \
    96 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH,III); }
    97 	#define LOGSTRING10(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III, JJJ) \
    98 		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH,III,JJJ); }
    99 
   100 
   101 #else
   102 
   103 	// Defines
   104 	#define LOGSTRING(AAA)
   105 	#define LOGSTRING2(AAA,BBB)
   106 	#define LOGSTRING3(AAA,BBB,CCC)
   107 	#define LOGSTRING4(AAA,BBB,CCC,DDD)
   108 	#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE)
   109 	#define LOGSTRING6(AAA,BBB,CCC,DDD,EEE,FFF)
   110 	#define LOGSTRING7(AAA,BBB,CCC,DDD,EEE,FFF,GGG)
   111 	#define LOGSTRING8(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH)
   112 	#define LOGSTRING9(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III)
   113 	#define LOGSTRING10(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III, JJJ)
   114 
   115 #endif
   116 
   117 #endif