1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/filelogger/INC/FLOGGER.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,210 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// FLogger Client side header
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 +@file
1.23 +@publishedAll
1.24 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.25 +*/
1.26 +
1.27 +#ifndef __FLOGGER_H__
1.28 +#define __FLOGGER_H__
1.29 +
1.30 +#include <e32base.h>
1.31 +
1.32 +/** Maximum log buffer size.
1.33 +@publishedAll
1.34 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.35 +*/
1.36 +const TInt KLogBufferSize=150;
1.37 +
1.38 +// [All of this start up stuff copied from DBMS]
1.39 +
1.40 +class FLogger
1.41 +/** Controls the flogger server.
1.42 +@publishedAll
1.43 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.44 +*/
1.45 + {
1.46 +public:
1.47 + class TSignal
1.48 +/**
1.49 +@publishedAll
1.50 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.51 +*/
1.52 + {
1.53 + friend class FLogger;
1.54 + public:
1.55 + inline TSignal() {}
1.56 + inline TInt Set(const TDesC& aCommand);
1.57 +
1.58 + inline TSignal(TRequestStatus& aStatus);
1.59 +
1.60 + inline TPtrC Command() const;
1.61 +
1.62 + private:
1.63 + TRequestStatus* iStatus;
1.64 + TThreadId iId;
1.65 + };
1.66 +public:
1.67 + static TInt Start();
1.68 +
1.69 + IMPORT_C static TInt Run(TSignal& aSignal);
1.70 +
1.71 +private:
1.72 + static TInt Init();
1.73 + };
1.74 +
1.75 +
1.76 +/** The mode used to write to the log file.
1.77 +@publishedAll
1.78 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.79 +*/
1.80 +enum TFileLoggingMode
1.81 + {
1.82 + /** Log file mode has not been explicitly set. */
1.83 + EFileLoggingModeUnknown =0,
1.84 + /** Open the log file in append mode. */
1.85 + EFileLoggingModeAppend,
1.86 + /** Open the log file in overwrite mode. */
1.87 + EFileLoggingModeOverwrite,
1.88 + EFileLoggingModeAppendRaw,
1.89 + EFileLoggingModeOverwriteRaw
1.90 + };
1.91 +
1.92 +NONSHARABLE_CLASS(TLogFormatter16Overflow) :public TDes16Overflow
1.93 +/** Unicode overflow handler.
1.94 +@publishedAll
1.95 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.96 +*/
1.97 + {
1.98 +public:
1.99 + virtual void Overflow(TDes16& aDes);
1.100 + };
1.101 +
1.102 +NONSHARABLE_CLASS(TLogFormatter8Overflow) :public TDes8Overflow
1.103 +/** Overflow handler.
1.104 +@publishedAll
1.105 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.106 +*/
1.107 + {
1.108 +public:
1.109 + virtual void Overflow(TDes8& aDes);
1.110 + };
1.111 +
1.112 +class TLogFormatter
1.113 +/** Formatting methods for log file data.
1.114 +@publishedAll
1.115 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.116 +*/
1.117 + {
1.118 +public:
1.119 + TLogFormatter();
1.120 + void SetDateAndTime(TBool aUseDate,TBool aUseTime);
1.121 + TInt FormatTextToWritableBuffer(TDes8& aBuf, const TDesC16& aText) const;
1.122 + TInt FormatTextToWritableBuffer(TDes8& aBuf, const TDesC8& aText) const;
1.123 + TInt ConvertToWritableBuffer(TDes8& aBuf, TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
1.124 + TInt ConvertToWritableBuffer(TDes8& aBuf, TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
1.125 +private:
1.126 + void GetDateAndTimeL(TDes& aDate, TDes& aTime) const;
1.127 + void WriteL(TDes8& aTrg, const TDesC16& aSrc) const;
1.128 + void WriteL(TDes8& aTrg, const TDesC8& aSrc) const;
1.129 +private:
1.130 + TBool iUseDate;
1.131 + TBool iUseTime;
1.132 + TLogFormatter16Overflow iOverflow16;
1.133 + TLogFormatter8Overflow iOverflow8;
1.134 + };
1.135 +
1.136 +class TLogFile
1.137 +/** General access to packaged log files.
1.138 +@publishedAll
1.139 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.140 +*/
1.141 + {
1.142 +public:
1.143 + TLogFile();
1.144 + TLogFile(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode);
1.145 + TBool operator==(const TLogFile& aLogFile) const;
1.146 + void Set(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode);
1.147 + inline TBool Valid() const;
1.148 + inline TFileName Directory() const;
1.149 + inline TFileName Name() const;
1.150 + inline TFileLoggingMode Mode() const;
1.151 + inline void SetValid(TBool aValid);
1.152 +private:
1.153 + TBool iValid;
1.154 + TFileName iDirectory;
1.155 + TFileName iName;
1.156 + TFileLoggingMode iMode;
1.157 + };
1.158 +
1.159 +#include <flogger.inl>
1.160 +
1.161 +class RFileLogger : public RSessionBase
1.162 +/** Provides access methods to file logging.
1.163 +
1.164 +The file logger API contains both static and non-static versions of access
1.165 +functions to the file logging system.
1.166 +@publishedAll
1.167 +@deprecated Migrate to Open System Trace Instrumentation API instead
1.168 +*/
1.169 + {
1.170 +public:
1.171 + IMPORT_C RFileLogger();
1.172 + IMPORT_C ~RFileLogger();
1.173 + IMPORT_C TVersion Version() const;
1.174 + IMPORT_C TInt Connect();
1.175 + IMPORT_C void SetDateAndTime(TBool aUseDate,TBool aUseTime);
1.176 + IMPORT_C void CreateLog(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode);
1.177 + IMPORT_C void CloseLog();
1.178 + IMPORT_C void Write(const TDesC16& aText);
1.179 + IMPORT_C void WriteFormat(TRefByValue<const TDesC16> aFmt,...);
1.180 + IMPORT_C void WriteFormat(TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
1.181 + IMPORT_C void Write(const TDesC8& aText);
1.182 + IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt,...);
1.183 + IMPORT_C void WriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
1.184 + IMPORT_C void HexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
1.185 + IMPORT_C static void Write(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, const TDesC16& aText);
1.186 + IMPORT_C static void WriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC16> aFmt,...);
1.187 + IMPORT_C static void WriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
1.188 + IMPORT_C static void Write(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, const TDesC8& aText);
1.189 + IMPORT_C static void WriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC8> aFmt,...);
1.190 + IMPORT_C static void WriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
1.191 + IMPORT_C static void HexDump(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
1.192 + IMPORT_C TInt LastError() const;
1.193 + IMPORT_C TBool LogValid() const;
1.194 + IMPORT_C TBool LogSTI() const;
1.195 +
1.196 +private:
1.197 + TInt DoConnect();
1.198 + void DoWrite(const TDesC8& aBuf);
1.199 + void DoStaticWrite(const TDesC8& aBuf);
1.200 + void DoWriteFormat(TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
1.201 + void DoWriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
1.202 + static void DoStaticWriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
1.203 + static void DoStaticWriteFormat(const TDesC& aDir, const TDesC& aName, TFileLoggingMode aMode, TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
1.204 + void DoHexDump(const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
1.205 +private:
1.206 + TLogFormatter iFormatter;
1.207 + TLogFile iLogFile;
1.208 + TInt iLastError;
1.209 + TBool iLogSTI; /* CR1688 Flogger to use RDebug::Print */
1.210 +
1.211 + };
1.212 +
1.213 +#endif