sl@0: // Copyright (c) 2002-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: // LOGSERVERCLI.H sl@0: // sl@0: // sl@0: sl@0: #ifndef __LOGSERVERCLI_H__ sl@0: #define __LOGSERVERCLI_H__ sl@0: sl@0: // System includes sl@0: #include sl@0: sl@0: // User includes sl@0: #include sl@0: #include "LogCliServShared.h" sl@0: sl@0: class RLogSession : public RSessionBase sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: public: sl@0: /** sl@0: * Constructor sl@0: */ sl@0: RLogSession(); sl@0: sl@0: /** sl@0: * Connect to Log Server sl@0: */ sl@0: TInt Connect(); sl@0: sl@0: public: sl@0: sl@0: /** sl@0: * Asynchronous send to server. Reply received via aStatus sl@0: */ sl@0: void Send(TInt aType, const TIpcArgs& aArgs, TRequestStatus& aStatus) const; sl@0: sl@0: /** sl@0: * Synchronous send to server. Reply returned to caller sl@0: */ sl@0: TInt Send(TInt aType, const TIpcArgs& aArgs) const; sl@0: sl@0: /** sl@0: * Get the next free operation id sl@0: */ sl@0: inline TLogOperationId AllocateIdOperation(); sl@0: sl@0: /** sl@0: * Get the next free view id sl@0: */ sl@0: inline TLogViewId AllocateIdView(); sl@0: sl@0: private: sl@0: TInt SendWithRetry(TInt aType, const TIpcArgs& aParam) const; sl@0: void SendWithRetryAsync(TInt aType, const TIpcArgs& aParam, TRequestStatus& aStatus) const; sl@0: sl@0: private: sl@0: TLogOperationId iOperationId; sl@0: TLogViewId iViewId; sl@0: }; sl@0: sl@0: sl@0: inline TLogOperationId RLogSession::AllocateIdOperation() sl@0: { sl@0: return iOperationId++; sl@0: } sl@0: sl@0: inline TLogViewId RLogSession::AllocateIdView() sl@0: { sl@0: return iViewId++; sl@0: } sl@0: sl@0: sl@0: #ifdef LOGGING_ENABLED sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: _LIT(KLogFileName, "LogEng.txt"); sl@0: _LIT(KLogFolder, "LogEng"); sl@0: _LIT(KTimeFormat, "%02d.%02d:%02d:%06d "); sl@0: _LIT(KTextFormat, "%S"); sl@0: sl@0: class Log : public RFileLogger sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: { sl@0: public: sl@0: static void New(); sl@0: static void Write(const TDesC& aText); sl@0: static void WriteFormat(TRefByValue aFmt, ...); sl@0: sl@0: private: sl@0: static void PruneLogFile(); sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: #define LOGNEW Log::New() sl@0: #define LOGTEXT(AAA) { _LIT(KString, AAA); Log::Write(KString); } sl@0: #define LOGTEXT2(AAA, BBB) { _LIT(KString, AAA); Log::WriteFormat(TRefByValue(KString()), BBB); } sl@0: #define LOGTEXT3(AAA, BBB, CCC) { _LIT(KString, AAA); Log::WriteFormat(TRefByValue(KString()), BBB, CCC); } sl@0: #define LOGTEXT4(AAA, BBB, CCC, DDD) { _LIT(KString, AAA); Log::WriteFormat(TRefByValue(KString()), BBB, CCC, DDD); } sl@0: sl@0: #else sl@0: sl@0: #define LOGNEW sl@0: #define LOGTEXT(AAA) sl@0: #define LOGTEXT2(AAA, BBB) sl@0: #define LOGTEXT3(AAA, BBB, CCC) sl@0: #define LOGTEXT4(AAA, BBB, CCC, DDD) sl@0: sl@0: #endif sl@0: sl@0: sl@0: #endif sl@0: