RFileLogger Class Reference

#include <flogger.h>

Link against: flogger.lib

class RFileLogger : public RSessionBase

Inherits from

  • RFileLogger
    Public Member Functions
    RFileLogger()
    ~RFileLogger()
    IMPORT_C voidCloseLog()
    IMPORT_C TIntConnect()
    IMPORT_C voidCreateLog(const TDesC &, const TDesC &, TFileLoggingMode)
    IMPORT_C voidHexDump(const TText *, const TText *, const TUint8 *, TInt)
    IMPORT_C voidHexDump(const TDesC &, const TDesC &, TFileLoggingMode, const TText *, const TText *, const TUint8 *, TInt)
    IMPORT_C TIntLastError()
    IMPORT_C TBoolLogSTI()
    IMPORT_C TBoolLogValid()
    IMPORT_C voidSetDateAndTime(TBool, TBool)
    IMPORT_C TVersionVersion()
    IMPORT_C voidWrite(const TDesC16 &)
    IMPORT_C voidWrite(const TDesC8 &)
    IMPORT_C voidWrite(const TDesC &, const TDesC &, TFileLoggingMode, const TDesC16 &)
    IMPORT_C voidWrite(const TDesC &, const TDesC &, TFileLoggingMode, const TDesC8 &)
    IMPORT_C voidWriteFormat(TRefByValue< const TDesC16 >, ...)
    IMPORT_C voidWriteFormat(TRefByValue< const TDesC16 >, VA_LIST &)
    IMPORT_C voidWriteFormat(TRefByValue< const TDesC8 >, ...)
    IMPORT_C voidWriteFormat(TRefByValue< const TDesC8 >, VA_LIST &)
    IMPORT_C voidWriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, ...)
    IMPORT_C voidWriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, VA_LIST &)
    IMPORT_C voidWriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, ...)
    IMPORT_C voidWriteFormat(const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, VA_LIST &)
    Inherited Attributes
    RHandleBase::iHandle
    Inherited Enumerations
    RHandleBase:TAttributes
    RSessionBase:TAttachMode
    Inherited Functions
    RHandleBase::Attributes()const
    RHandleBase::BTraceId()const
    RHandleBase::Close()
    RHandleBase::DoExtendedClose()
    RHandleBase::Duplicate(const RThread &,TOwnerType)
    RHandleBase::FullName()const
    RHandleBase::FullName(TDes &)const
    RHandleBase::Handle()const
    RHandleBase::HandleInfo(THandleInfo *)
    RHandleBase::Name()const
    RHandleBase::NotifyDestruction(TRequestStatus &)
    RHandleBase::Open(const TFindHandleBase &,TOwnerType)
    RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
    RHandleBase::RHandleBase()
    RHandleBase::RHandleBase(TInt)
    RHandleBase::SetHandle(TInt)
    RHandleBase::SetHandleNC(TInt)
    RSessionBase::CreateSession(RServer2,const TVersion &)
    RSessionBase::CreateSession(RServer2,const TVersion &,TInt)
    RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
    RSessionBase::CreateSession(const TDesC &,const TVersion &)
    RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt)
    RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
    RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *)
    RSessionBase::Open(RMessagePtr2,TInt,TOwnerType)
    RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType)
    RSessionBase::Open(TInt,TOwnerType)
    RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType)
    RSessionBase::Send(TInt)const
    RSessionBase::Send(TInt,const TIpcArgs &)const
    RSessionBase::SendReceive(TInt)const
    RSessionBase::SendReceive(TInt,TRequestStatus &)const
    RSessionBase::SendReceive(TInt,const TIpcArgs &)const
    RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
    RSessionBase::SetReturnedHandle(TInt)
    RSessionBase::SetReturnedHandle(TInt,RHandleBase &)
    RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &)
    RSessionBase::ShareAuto()
    RSessionBase::ShareProtected()

    Detailed Description

    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

    Constructor & Destructor Documentation

    RFileLogger ( )

    IMPORT_CRFileLogger()

    Creates a default RFileLogger object.

    ~RFileLogger ( )

    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.

    Member Function Documentation

    CloseLog ( )

    IMPORT_C voidCloseLog()

    Closes the log file, iLogFile.

    This function closes the log file previously created or opened by CreateLog().

    Connect ( )

    IMPORT_C TIntConnect()

    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.

    CreateLog ( const TDesC &, const TDesC &, TFileLoggingMode )

    IMPORT_C voidCreateLog(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode
    )

    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.

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides or is to be created.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened, either EAppend or EOverwrite.

    HexDump ( const TText *, const TText *, const TUint8 *, TInt )

    IMPORT_C voidHexDump(const TText *aHeader,
    const TText *aMargin,
    const TUint8 *aPtr,
    TIntaLen
    )

    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
    .
    .
    .
    ParameterDescription
    aHeaderA label for the hex dump entry. The label has a sequence number appended to it automatically.
    aMarginA 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.
    aPtrThe data that is to be converted to a hex string.
    aLenHow many of the characters in aPtr are to be converted. Conversion always starts from position 0 within aPtr.

    HexDump ( const TDesC &, const TDesC &, TFileLoggingMode, const TText *, const TText *, const TUint8 *, TInt )

    IMPORT_C voidHexDump(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    const TText *aHeader,
    const TText *aMargin,
    const TUint8 *aPtr,
    TIntaLen
    )[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
    .
    .
    .

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aHeaderA label for the hex dump entry. The label has a sequence number appended to it automatically.
    aMarginA 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.
    aPtrThe data that is to be converted to a hex string.
    aLenHow many of the characters in aPtr are to be converted. Conversion always starts from position 0 within aPtr.

    LastError ( )

    IMPORT_C TIntLastError()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.

    LogSTI ( )

    IMPORT_C TBoolLogSTI()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

    LogValid ( )

    IMPORT_C TBoolLogValid()const

    Returns the status of the log.

    Returns: ETrue if the log file is valid; otherwise EFalse.

    SetDateAndTime ( TBool, TBool )

    IMPORT_C voidSetDateAndTime(TBoolaUseDate,
    TBoolaUseTime
    )

    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().

    ParameterDescription
    aUseDateUse ETrue to log the date, otherwise EFalse.
    aUseTimeUse ETrue to log the time, otherwise EFalse.

    Version ( )

    IMPORT_C TVersionVersion()const

    Returns the version number.

    Returns: The version number.

    Write ( const TDesC16 & )

    IMPORT_C voidWrite(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.

    ParameterDescription
    aTextThe Unicode string to write to the open log.

    Write ( const TDesC8 & )

    IMPORT_C voidWrite(const TDesC8 &aText)

    Writes a string of 8-bit characters to an open log, iLogFile, if it is a valid file.

    ParameterDescription
    aTextThe 8-bit character string to write to the open log.

    Write ( const TDesC &, const TDesC &, TFileLoggingMode, const TDesC16 & )

    IMPORT_C voidWrite(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    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.

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aTextThe Unicode string to write to the log.

    Write ( const TDesC &, const TDesC &, TFileLoggingMode, const TDesC8 & )

    IMPORT_C voidWrite(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    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".

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aTextThe 8-bit string to write to the log.

    WriteFormat ( TRefByValue< const TDesC16 >, ... )

    IMPORT_C voidWriteFormat(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.

    ParameterDescription
    aFmtThe 16-bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type.

    WriteFormat ( TRefByValue< const TDesC16 >, VA_LIST & )

    IMPORT_C voidWriteFormat(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.

    ParameterDescription
    aFmtThe 16-bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type.
    aListA pointer to an argument list.

    WriteFormat ( TRefByValue< const TDesC8 >, ... )

    IMPORT_C voidWriteFormat(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.

    ParameterDescription
    aFmtThe 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.

    WriteFormat ( TRefByValue< const TDesC8 >, VA_LIST & )

    IMPORT_C voidWriteFormat(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.

    ParameterDescription
    aFmtThe 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.
    aListA pointer to an argument list.

    WriteFormat ( const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, ... )

    IMPORT_C voidWriteFormat(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    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.

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aFmtThe 16 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type.

    WriteFormat ( const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC16 >, VA_LIST & )

    IMPORT_C voidWriteFormat(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    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.

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aFmtThe 16 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC16 type.
    aListA pointer to an argument list.

    WriteFormat ( const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, ... )

    IMPORT_C voidWriteFormat(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    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".

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aFmtThe 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.

    WriteFormat ( const TDesC &, const TDesC &, TFileLoggingMode, TRefByValue< const TDesC8 >, VA_LIST & )

    IMPORT_C voidWriteFormat(const TDesC &aDir,
    const TDesC &aName,
    TFileLoggingModeaMode,
    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".

    ParameterDescription
    aDirThe directory relative to 'C:\Logs\' where the log file resides.
    aNameThe name of the log file.
    aModeThe mode in which the log file should be opened: either EAppend or EOverwrite.
    aFmtThe 8 bit non modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.
    aListA pointer to an argument list.