#include <flogger.h>
class RFileLogger : public RSessionBase |
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 &) |
Inherited Attributes | |
---|---|
RHandleBase::iHandle |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes | |
RSessionBase:TAttachMode |
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. DeprecatedMigrate to Open System Trace Instrumentation API instead
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().
Returns: KErrNone if successful, otherwise one of the system-wide error codes.
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.
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides or is to be created. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened, either EAppend or EOverwrite. |
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 . . .
Parameter | Description |
---|---|
aHeader | A label for the hex dump entry. The label has a sequence number appended to it automatically. |
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. |
aPtr | The data that is to be converted to a hex string. |
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 . . .
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
aHeader | A label for the hex dump entry. The label has a sequence number appended to it automatically. |
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. |
aPtr | The data that is to be converted to a hex string. |
aLen | How many of the characters in aPtr are to be converted. Conversion always starts from position 0 within aPtr. |
IMPORT_C TInt | LastError | ( | ) | const |
Returns the last error status that has been set.
Returns: This value can be set to any of the valid error codes from any of the functions in this class.
IMPORT_C TBool | LogSTI | ( | ) | const |
Returns patchable constant value.
Returns: This value specify the logging output. The default value EFalse cause that the logs are stored to filesystem. ETrue intorduced as in CR 1688 is used for logging using RDebug::Print
IMPORT_C TBool | LogValid | ( | ) | const |
Returns the status of the log.
Returns: ETrue if the log file is valid; otherwise EFalse.
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().
Parameter | Description |
---|---|
aUseDate | Use ETrue to log the date, otherwise EFalse. |
aUseTime | Use ETrue to log the time, otherwise EFalse. |
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
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".
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
aFmt | The 16-bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type. |
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
aFmt | The 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type. |
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.
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
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.
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
aFmt | The 16 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type. |
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".
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
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".
Parameter | Description |
---|---|
aDir | The directory relative to 'C:\Logs\' where the log file resides. |
aName | The name of the log file. |
aMode | The mode in which the log file should be opened: either EAppend or EOverwrite. |
aFmt | The 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type. |
aList | A pointer to an argument list. |