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.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __SCHLOGGER_H__
sl@0
    17
#define __SCHLOGGER_H__
sl@0
    18
sl@0
    19
#ifdef __SCHLOGGING__
sl@0
    20
	#pragma message(__FILE__ ": (15) WARNING! Schedule logging is enabled")
sl@0
    21
	
sl@0
    22
	// System includes
sl@0
    23
	#include <f32file.h>
sl@0
    24
	
sl@0
    25
	/** 
sl@0
    26
	Literal constants
sl@0
    27
	@internalComponent
sl@0
    28
	*/
sl@0
    29
	_LIT(KSchSvrLogFile,	"SCHSVR.TXT");
sl@0
    30
	_LIT(KSchSvrLogFolder,	"SCHSVR");
sl@0
    31
sl@0
    32
	//
sl@0
    33
	// ------> CSheduleServerLog (header)
sl@0
    34
	//
sl@0
    35
	class CSheduleServerLog : public CBase
sl@0
    36
	/** 
sl@0
    37
	@internalComponent
sl@0
    38
	*/
sl@0
    39
		{
sl@0
    40
	//
sl@0
    41
	public: // CONSTRUCT / DESTRUCT
sl@0
    42
	//
sl@0
    43
		static CSheduleServerLog* NewL(const TDesC& aLogFileName);
sl@0
    44
		~CSheduleServerLog();
sl@0
    45
sl@0
    46
	//
sl@0
    47
	private: // INTERNAL CONSTRUCT
sl@0
    48
	//
sl@0
    49
		CSheduleServerLog();
sl@0
    50
		void ConstructL(const TDesC& aLogFileName);
sl@0
    51
sl@0
    52
	//
sl@0
    53
	public: // ACCESS
sl@0
    54
	//
sl@0
    55
		void Log(TRefByValue<const TDesC> aFmt,...);
sl@0
    56
		void LogList(TRefByValue<const TDesC> aFmt, VA_LIST aList);
sl@0
    57
		void SeekEnd();
sl@0
    58
sl@0
    59
	//
sl@0
    60
	private: // INTERNAL
sl@0
    61
	//
sl@0
    62
		void Write(const TDesC& aText);
sl@0
    63
		void Write(const TDesC& aFmt, VA_LIST& aList);
sl@0
    64
		void WriteWithTimeStamp(const TDesC& aText);
sl@0
    65
		void NewLine();
sl@0
    66
sl@0
    67
	//
sl@0
    68
	private: // MEMBER DATA
sl@0
    69
	//
sl@0
    70
		RFs iFs;
sl@0
    71
		RFile iFile;
sl@0
    72
	};
sl@0
    73
sl@0
    74
sl@0
    75
	/** 
sl@0
    76
	Defines
sl@0
    77
	@internalComponent
sl@0
    78
	*/
sl@0
    79
	#define LOGSTRING(AAA) \
sl@0
    80
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(tempLogDes()); }
sl@0
    81
	#define LOGSTRING2(AAA,BBB) \
sl@0
    82
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB); }
sl@0
    83
	#define LOGSTRING3(AAA,BBB,CCC) \
sl@0
    84
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); }
sl@0
    85
	#define LOGSTRING4(AAA,BBB,CCC,DDD) \
sl@0
    86
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD); }
sl@0
    87
	#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE) \
sl@0
    88
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE); }
sl@0
    89
	#define LOGSTRING6(AAA,BBB,CCC,DDD,EEE,FFF) \
sl@0
    90
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF); }
sl@0
    91
	#define LOGSTRING7(AAA,BBB,CCC,DDD,EEE,FFF,GGG) \
sl@0
    92
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG); }
sl@0
    93
	#define LOGSTRING8(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH) \
sl@0
    94
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH); }
sl@0
    95
	#define LOGSTRING9(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III) \
sl@0
    96
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH,III); }
sl@0
    97
	#define LOGSTRING10(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III, JJJ) \
sl@0
    98
		{ _LIT(tempLogDes, AAA); reinterpret_cast<CSheduleServerLog*>(Dll::Tls())->Log(TRefByValue<const TDesC>(tempLogDes()),BBB,CCC,DDD,EEE,FFF,GGG,HHH,III,JJJ); }
sl@0
    99
sl@0
   100
sl@0
   101
#else
sl@0
   102
sl@0
   103
	// Defines
sl@0
   104
	#define LOGSTRING(AAA)
sl@0
   105
	#define LOGSTRING2(AAA,BBB)
sl@0
   106
	#define LOGSTRING3(AAA,BBB,CCC)
sl@0
   107
	#define LOGSTRING4(AAA,BBB,CCC,DDD)
sl@0
   108
	#define LOGSTRING5(AAA,BBB,CCC,DDD,EEE)
sl@0
   109
	#define LOGSTRING6(AAA,BBB,CCC,DDD,EEE,FFF)
sl@0
   110
	#define LOGSTRING7(AAA,BBB,CCC,DDD,EEE,FFF,GGG)
sl@0
   111
	#define LOGSTRING8(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH)
sl@0
   112
	#define LOGSTRING9(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III)
sl@0
   113
	#define LOGSTRING10(AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH,III, JJJ)
sl@0
   114
sl@0
   115
#endif
sl@0
   116
sl@0
   117
#endif