class RFileLogger : public RSessionBase |
Provides access methods to file logging.
The file logger API contains both static and non-static versions of access functions to the file logging system. Migrate to Open System Trace Instrumentation API instead
Public Member Functions | |
---|---|
RFileLogger() | |
~RFileLogger() | |
IMPORT_C void | CloseLog() |
IMPORT_C TInt | Connect() |
IMPORT_C void | CreateLog(const TDesC &, const TDesC &, TFileLoggingMode) |
IMPORT_C void | HexDump(const TText *, const TText *, const TUint8 *, TInt) |
IMPORT_C void | HexDump(const TDesC &, const TDesC &, TFileLoggingMode, const TText *, const TText *, const TUint8 *, TInt) |
IMPORT_C TInt | LastError() |
IMPORT_C TBool | LogSTI() |
IMPORT_C TBool | LogValid() |
IMPORT_C void | SetDateAndTime(TBool, TBool) |
IMPORT_C TVersion | Version() |
IMPORT_C void | Write(const TDesC16 &) |
IMPORT_C void | Write(const TDesC8 &) |
IMPORT_C void | Write(const TDesC &, const TDesC &, TFileLoggingMode, const TDesC16 &) |
IMPORT_C void | Write(const TDesC &, const TDesC &, TFileLoggingMode, const TDesC8 &) |
IMPORT_C void | WriteFormat(TRefByValue< const TDesC16 >, ...) |
IMPORT_C void | WriteFormat(TRefByValue< const TDesC16 >, VA_LIST &) |
IMPORT_C void | WriteFormat(TRefByValue< const TDesC8 >, ...) |
IMPORT_C void | WriteFormat(TRefByValue< const TDesC8 >, VA_LIST &) |
IMPORT_C void | WriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, ...) |
IMPORT_C void | WriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, VA_LIST &) |
IMPORT_C void | WriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, ...) |
IMPORT_C void | WriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, VA_LIST &) |
Private Member Functions | |
---|---|
TInt | DoConnect() |
void | DoHexDump(const TText *, const TText *, const TUint8 *, TInt) |
void | DoStaticWrite(const TDesC8 &) |
void | DoStaticWriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, VA_LIST &) |
void | DoStaticWriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, VA_LIST &) |
void | DoWrite(const TDesC8 &) |
void | DoWriteFormat(TRefByValue< const TDesC16 >, VA_LIST &) |
void | DoWriteFormat(TRefByValue< const TDesC8 >, VA_LIST &) |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes | |
RSessionBase:TAttachMode |
Private Attributes | |
---|---|
TLogFormatter | iFormatter |
TInt | iLastError |
TLogFile | iLogFile |
TBool | iLogSTI |
Inherited Attributes | |
---|---|
RHandleBase::iHandle |
IMPORT_C | ~RFileLogger | ( | ) |
Empty destructor. Clients with open sessions must end the session by calling Close() beforehand. Note that it does not delete the log file.
IMPORT_C void | CloseLog | ( | ) |
Closes the log file, iLogFile.
This function closes the log file previously created or opened by CreateLog().
IMPORT_C TInt | Connect | ( | ) |
Connects to the file logger server with the default number of message slots, which is 8.
This function does not need to be called if you are using the static versions of Write(), WriteFormat() or HexDump().
IMPORT_C void | CreateLog | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode | |||
) |
Creates or opens a file for logging.
When specifying a directory for logging only specify the relative path to 'C:\Logs\' and do not append a '\' to the end of the path either. CreateLog() only creates the specified log file if the directory exists. This means that switching logging on and off can be achieved without having to re-compile, by just removing or renaming the log directory.
aLogFile.iValid is set according to whether logging will actually occur or not.
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides or is to be created. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened, either EAppend or EOverwrite. |
TInt | DoConnect | ( | ) | [private] |
Connects to the flogger server - default number of message slots = 8
void | DoHexDump | ( | const TText * | aHeader, |
const TText * | aMargin, | |||
const TUint8 * | aPtr, | |||
TInt | aLen | |||
) | [private] |
Static Write. Dumps arbitrary data to the log file as a standard hex dump.
This function has poor performance since it performs a full connection and disconnection to the flogger server. Example of aHeader/aMargin. If "aHeader" is set to "Fn Output:" and "aMargin" is set to " ", then output would look like (for a print of the alphabet): 14/11/2002 12:32:24 Fn Output:0000 : 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop 14/11/2002 12:32:24 0010 : 71 72 73 74 75 76 77 78 79 7a qrstuvwxyz
const TText * aHeader | Specify a string to be printed before the first hex line. Leave as null or an empty string for no header. |
const TText * aMargin | Specify a string to be printed before each subsequent line. Leave as null or an empty string for no Margin. |
const TUint8 * aPtr | pointer to the data being dumped. |
TInt aLen | the number of bytes to dump |
void | DoStaticWrite | ( | const TDesC8 & | aBuf | ) | [private] |
Sends the pre-formatted write string to the flogger server.
const TDesC8 & aBuf | text to write |
void | DoStaticWriteFormat | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
TRefByValue< const TDesC16 > | aFmt, | |||
VA_LIST & | aList | |||
) | [private, static] |
Sends a format write string to the flogger server to write to the specified file.
const TDesC & aDir | Path of the log file. |
const TDesC & aName | Name of the log file. |
TFileLoggingMode aMode | |
TRefByValue< const TDesC16 > aFmt | c-style formatted text to be written. |
VA_LIST & aList | any variables required by the format. |
void | DoStaticWriteFormat | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
TRefByValue< const TDesC8 > | aFmt, | |||
VA_LIST & | aList | |||
) | [private, static] |
Sends a format write string to the flogger server to write to the specified file. There is no pre-condition.
const TDesC & aDir | Path of the log file. |
const TDesC & aName | Name of the log file. |
TFileLoggingMode aMode | |
TRefByValue< const TDesC8 > aFmt | c-style formatted text to be written. |
VA_LIST & aList | any variables required by the format. |
void | DoWrite | ( | const TDesC8 & | aBuf | ) | [private] |
Sends the pre-formatted write string to the flogger server.
const TDesC8 & aBuf | 8-bit text to be written. |
void | DoWriteFormat | ( | TRefByValue< const TDesC16 > | aFmt, |
VA_LIST & | aList | |||
) | [private] |
Trim format string before sending to the flogger server.
TRefByValue< const TDesC16 > aFmt | c-style formatted text to be written. |
VA_LIST & aList | any variables required by the format. |
void | DoWriteFormat | ( | TRefByValue< const TDesC8 > | aFmt, |
VA_LIST & | aList | |||
) | [private] |
Trim format string before sending to the flogger server.
TRefByValue< const TDesC8 > aFmt | c-style formatted text to be written. |
VA_LIST & aList | any variables required by the format. |
IMPORT_C void | HexDump | ( | const TText * | aHeader, |
const TText * | aMargin, | |||
const TUint8 * | aPtr, | |||
TInt | aLen | |||
) |
Writes a hex dump of the specified data to the log.
The format of the hex dump entry is a header followed by the hex string of the data followed by any printable characters (non printable characters are substituted with '.'). For example,
RLog_Ex0000 : 41 42 6C 6B 0A 0A 45 46 20 20 78 7A ABlk..EF xz RL_cont0001 : 43 44 6C 6B 0A 0A 45 46 20 20 78 7A CDlk..EF xz RL_cont0002 : 45 46 6C 6B 0A 0A 47 48 20 20 78 7A EFlk..GH xz . . .
const TText * aHeader | A label for the hex dump entry. The label has a sequence number appended to it automatically. |
const TText * aMargin | A continuation label if the hex dump exceeds one line. This label is displayed on all subsequent lines after line one and also has a sequence number appended to it. |
const TUint8 * aPtr | The data that is to be converted to a hex string. |
TInt aLen | How many of the characters in aPtr are to be converted. Conversion always starts from position 0 within aPtr. |
IMPORT_C void | HexDump | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
const TText * | aHeader, | |||
const TText * | aMargin, | |||
const TUint8 * | aPtr, | |||
TInt | aLen | |||
) | [static] |
Writes a hex dump of the specified data to the log.
The format of the hex dump entry is a header followed by the hex string of the data followed by any printable characters (non printable characters are substituted with '.'). For example,
RLog_Ex0000 : 41 42 6C 6B 0A 0A 45 46 20 20 78 7A ABlk..EF xz RL_cont0001 : 43 44 6C 6B 0A 0A 45 46 20 20 78 7A CDlk..EF xz RL_cont0002 : 45 46 6C 6B 0A 0A 47 48 20 20 78 7A EFlk..GH xz . . .
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
const TText * aHeader | A label for the hex dump entry. The label has a sequence number appended to it automatically. |
const TText * aMargin | A continuation label if the hex dump exceeds one line. This label is displayed on all subsequent lines after line one and also has a sequence number appended to it. |
const TUint8 * aPtr | The data that is to be converted to a hex string. |
TInt aLen | How many of the characters in aPtr are to be converted. Conversion always starts from position 0 within aPtr. |
IMPORT_C void | SetDateAndTime | ( | TBool | aUseDate, |
TBool | aUseTime | |||
) |
Specifies whether time and/or date should be appended to log data.
Appending of the time and date to log entries can be switched on and off at anytime between creation and destruction of RFileLogger.
This function does not need to be called if you are using the static versions of Write(), WriteFormat() or HexDump().
IMPORT_C void | Write | ( | const TDesC16 & | aText | ) |
Writes a string of Unicode characters to an open log, iLogFile, if it is a valid file.
Note that the text will be converted to an 8 bit format for the log file.
const TDesC16 & aText | The Unicode string to write to the open log. |
IMPORT_C void | Write | ( | const TDesC8 & | aText | ) |
Writes a string of 8-bit characters to an open log, iLogFile, if it is a valid file.
const TDesC8 & aText | The 8-bit character string to write to the open log. |
IMPORT_C void | Write | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
const TDesC16 & | aText | |||
) | [static] |
Writes a string of 16-bit characters to an open log.
Connects to the logging server, creates/opens the log file and write aText to it.
This is a "static write".
Note that the text will be converted to an 8 bit format for the log file.
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
const TDesC16 & aText | The Unicode string to write to the log. |
IMPORT_C void | Write | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
const TDesC8 & | aText | |||
) | [static] |
Writes a string of 8-bit characters to an open log.
Connects to the logging server, creates/opens the log file and writes aText to it.
This is a "static write".
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
const TDesC8 & aText | The 8-bit string to write to the log. |
IMPORT_C void | WriteFormat | ( | TRefByValue< const TDesC16 > | aFmt, |
... | ||||
) |
Formats the remaining arguments of the function according to aFmt, and writes the result to the log, iLogFile, if it is a valid file.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments is dictated by the structure of the directives in aFmt.
Note that the text will be converted to an 8 bit format for the log file.
TRefByValue< const TDesC16 > aFmt | The 16-bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type. |
... |
IMPORT_C void | WriteFormat | ( | TRefByValue< const TDesC16 > | aFmt, |
VA_LIST & | aList | |||
) |
Formats the arguments pointed to by aList according to aFmt, and writes the result to the log, iLogFile, if it is a valid file.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments pointed to by aList is dictated by the structure of the directives in aFmt.
Note that the text will be converted to an 8 bit format for the log file.
TRefByValue< const TDesC16 > aFmt | The 16-bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type. |
VA_LIST & aList | A pointer to an argument list. |
IMPORT_C void | WriteFormat | ( | TRefByValue< const TDesC8 > | aFmt, |
... | ||||
) |
Formats the remaining arguments of the function according to aFmt, and writes the result to the log, iLogFile, if it is a valid file.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments is dictated by the structure of the directives in aFmt.
TRefByValue< const TDesC8 > aFmt | The 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type. |
... |
IMPORT_C void | WriteFormat | ( | TRefByValue< const TDesC8 > | aFmt, |
VA_LIST & | aList | |||
) |
Formats the arguments pointed to by aList according to aFmt, and writes the result to the log, iLogFile, if it is a valid file.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments pointed to by aList is dictated by the structure of the directives in aFmt.
TRefByValue< const TDesC8 > aFmt | The 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type. |
VA_LIST & aList | A pointer to an argument list. |
IMPORT_C void | WriteFormat | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
TRefByValue< const TDesC16 > | aFmt, | |||
... | ||||
) | [static] |
Formats the remaining arguments of the function according to aFmt and writes the result to the log.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments is dictated by the structure of the directives in aFmt.
Connects to the logging server, creates/opens the log file and writes the text arguments to it.
This is a "static write".
Note that the text will be converted to an 8 bit format for the log file.
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
TRefByValue< const TDesC16 > aFmt | The 16 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type. |
... |
IMPORT_C void | WriteFormat | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
TRefByValue< const TDesC16 > | aFmt, | |||
VA_LIST & | aList | |||
) | [static] |
Formats the arguments pointed to by aList according to aFmt, and writes the result to the log.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments pointed to by aList is dictated by the structure of the directives in aFmt.
Connects to the logging server, creates/opens the log file and writes the text arguments to it.
This is a "static write".
Note that the text will be converted to an 8 bit format for the log file.
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
TRefByValue< const TDesC16 > aFmt | The 16 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type. |
VA_LIST & aList | A pointer to an argument list. |
IMPORT_C void | WriteFormat | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
TRefByValue< const TDesC8 > | aFmt, | |||
... | ||||
) | [static] |
Formats the remaining arguments of the function according to aFmt and writes the result to the log.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments is dictated by the structure of the directives in aFmt.
Connects to the logging server, creates/opens the log file and writes the text arguments to it.
This is a "static write".
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
TRefByValue< const TDesC8 > aFmt | The 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type. |
... |
IMPORT_C void | WriteFormat | ( | const TDesC & | aDir, |
const TDesC & | aName, | |||
TFileLoggingMode | aMode, | |||
TRefByValue< const TDesC8 > | aFmt, | |||
VA_LIST & | aList | |||
) | [static] |
Formats the arguments pointed to by aList according to aFmt, and writes the result to the log.
The format string aFmt contains literal text, embedded with directives, for converting the trailing list of arguments into text. The number and type of arguments pointed to by aList is dictated by the structure of the directives in aFmt.
Connects to the logging server, creates/opens the log file and writes the text arguments to it.
This is a "static write".
const TDesC & aDir | The directory relative to 'C:\Logs\' where the log file resides. |
const TDesC & aName | The name of the log file. |
TFileLoggingMode aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
TRefByValue< const TDesC8 > aFmt | The 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type. |
VA_LIST & aList | A pointer to an argument list. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.