Location: `logfile.h`

# Class `CLogFile`

`CLogFile`

#### Description

Class to generate a text file containing logging information.

Defined in `CLogFile`:
`NewL()`, `NewLC()`, `~LogFile()`, `Log()`, `LogTime()`, `LogBytes()`, `LogNewLine()`, `SetAutoFlush()`, `SetAutoTimeStamp()`, `SetAutoNewline()`, `StaticLogL()`

##

### `NewL()`

`static CLogFile* NewL(const TDesC& aFileName, TBool aInitialiseLog);`

#### Description

Create a CLogFile object.

#### Parameters

`const TDesC& aFileName` | The name of the file to create.
`TBool aInitialiseLog` | If true, and the log file already exists, previous contents will be deleted. If false, append to any existing contents.

#### Return value

`CCLogFile*` | A pointer to the created instance of CLogFile.

### `NewLC()`

`static CLogFile* NewLC(const TDesC& aFileName, TBool aInitialiseLog);`

#### Description

Create a CLogFile object.

#### Parameters

`const TDesC& aFileName` | The name of the file to create.
`TBool aInitialiseLog` | If true, and the log file already exists, previous contents will be deleted. If false, append to any existing contents.

#### Return value

`CCLogFile*` | A pointer to the created instance of CLogFile.

### `~CLogFile()`

`~CLogFile();`

#### Description

Destroy the object and release all memory objects.

### `Log()`

`void Log(TUint8 aByte);
void Log(TUint aNumber);
void Log(const TDesC8& aText);
void Log(const TDesC& aText);
`

#### Description

Append the byte to the log file (if not a printable char, it will be logged as ascii-hex).
Append the integer to the log file (logged as ascii-hex).
Append text to the log file.

#### Parameters

`TUint8 aByte` | The byte to log.
`TUint aNumber` | The integer to log.
`const TDesC8& aText` | The text to log.
`const TDesC& aText` | The text to log.

### `LogTime()`

`void LogTime();`

#### Description

Append a timestamp to the log file. Timestamps are in seconds with three decimal places (but resolution is limited to system timer tick period)

### `LogBytes()`

`void LogBytes(const TDesC8& aBuffer);`

#### Description

Append the bytes to the log file (non-printable bytes will be logged as ascii-hex)

#### Parameters

`const TDesC8& aBuffer` | The bytes to log.

### `LogNewline()`

`void LogNewline();`

#### Description

Start a newline in the log file.

### `SetAutoFlush()`

`void SetAutoFlush(TBool aOn);`

#### Description

Turn AutoFlush on or off. AutoFlush will automatically flush the log file after each write.

#### Parameters

`cTBool aOn` | If true turns AutoFlush on.

### `SetAutoTimeStamp()`

`void SetAutoTimeStamp(TBool aOn);`

#### Description

Turn AutoTimeStamp on or off. AutoTimeStamp will add a timestamp to the start of each new line in the log.

#### Parameters

`TBool aOn` | If true turn AutoTimeStamp on.

### `SetAutoNewline()`

`void SetAutoNewline(TBool aOn);`

#### Description

Turn AutoNewline on or off. AutoNewline starts a new line after each log operation.

#### Parameters

`TBool aOn` | If true turn AutoNewline on.

### `StaticLogL()`

`static void StaticLogL(const TDesC& aFileName, const TDesC8& aText);
static void StaticLogL(const TDesC& aFileName, const TDesC& aText);`

#### Description

Static option to append text to the log file.

#### Parameters

`const TDesC& aFileName` | The file to append to.
`const TDesC8& aText` | The text to append.
`const TDesC& aText` | The text to append.