libraries/iosrv/server/log.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // log.h
       
     2 // 
       
     3 // Copyright (c) 2006 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef __LOG_H__
       
    14 #define __LOG_H__
       
    15 
       
    16 #include <e32base.h>
       
    17 #include <f32file.h>
       
    18 #include "server.h"
       
    19 
       
    20 #ifdef _DEBUG
       
    21 //#define IOSRV_LOGGING
       
    22 #endif
       
    23 
       
    24 #ifdef IOSRV_LOGGING
       
    25 
       
    26 #ifdef IOSRV_LOGGING_USES_CLOGGER // This is defined in the mmp
       
    27 #include <fshell/clogger.h>
       
    28 #endif
       
    29 
       
    30 #define LOG(x) x
       
    31 #define OBJ_NAME(x) TName objName((x).Name())
       
    32 
       
    33 class CIoLog : public CBase
       
    34 	{
       
    35 public:
       
    36 	static CIoLog* NewL(RFs& aFs);
       
    37 	~CIoLog();
       
    38 	static void StartServiceLC(const RMsg& aMessage);
       
    39 	static void LogCompletion(const RMsg& aMessage, TInt aError);
       
    40 	static void Write(const TDesC& aData);
       
    41 	static void Printf(TRefByValue<const TDesC> aFmt, ...);
       
    42 	static const TDesC* StringifyError(TInt aError);
       
    43 	static const TDesC* StringifyOpcode(TInt aOpCode);
       
    44 private:
       
    45 	CIoLog(RFs& aFs);
       
    46 	void ConstructL();
       
    47 	static CIoLog& Self();
       
    48 	static void EndService(TAny* aSelf);
       
    49 private:
       
    50 	RFs& iFs;
       
    51 #ifdef IOSRV_LOGGING_USES_CLOGGER
       
    52 	RClogger iClogger;
       
    53 #else
       
    54 	RFile iFile;
       
    55 	TBuf8<0x100> iNarrowBuf;
       
    56 #endif
       
    57 	TBuf<0x100> iScratchBuf;
       
    58 	TBool iInServiceL;
       
    59 	};
       
    60 
       
    61 #if !defined(__WINS__) || defined (EKA2)
       
    62 extern CIoLog* gLog;
       
    63 #endif
       
    64 
       
    65 #else
       
    66 
       
    67 #define LOG(x)
       
    68 #define OBJ_NAME(x)
       
    69 
       
    70 #endif // IOSRV_LOGGING
       
    71 
       
    72 #endif // __LOG_H__