VT100 Terminal App
Circle VT100 module documentation
Loading...
Searching...
No Matches
CTFileLog Class Reference

Provides file-based persistence for Circle logger messages. More...

#include <TFileLog.h>

Inheritance diagram for CTFileLog:

Public Member Functions

bool Initialize (CLogger &logger, const char *fileName, CDevice *fallbackTarget)
 Prepare the log target with logger, file path, and fallback device.
 
void SetFallback (CDevice *fallbackTarget)
 Change the device used when file logging is unavailable.
 
bool Start ()
 Attach to the logger and begin capturing output.
 
void Stop ()
 Detach from the logger and flush pending output.
 
int Write (const void *buffer, size_t count) override
 Write a chunk of log data and mirror to the fallback if needed.
 

Static Public Member Functions

static CTFileLogGet ()
 Access the singleton file log device.
 

Detailed Description

Provides file-based persistence for Circle logger messages.

The singleton integrates with CLogger, writes each message to the mounted filesystem using FatFs, and mirrors output to a fallback CDevice whenever the SD card is missing. It manages buffering thresholds and emits a startup banner to aid post-mortem analysis.

Member Function Documentation

◆ Get()

CTFileLog * CTFileLog::Get ( )
static

Access the singleton file log device.

Returns
Pointer to the file log instance.

◆ Initialize()

bool CTFileLog::Initialize ( CLogger &  logger,
const char *  fileName,
CDevice *  fallbackTarget 
)

Prepare the log target with logger, file path, and fallback device.

Parameters
loggerLogger whose output should be mirrored.
fileNamePath to the log file on the SD card.
fallbackTargetDevice used when file logging is unavailable.
Returns
TRUE on success, FALSE on failure.

◆ SetFallback()

void CTFileLog::SetFallback ( CDevice *  fallbackTarget)

Change the device used when file logging is unavailable.

Parameters
fallbackTargetDevice to receive mirrored log output.

◆ Start()

bool CTFileLog::Start ( )

Attach to the logger and begin capturing output.

Returns
TRUE if logging started, FALSE otherwise.

◆ Write()

int CTFileLog::Write ( const void *  buffer,
size_t  count 
)
override

Write a chunk of log data and mirror to the fallback if needed.

Parameters
bufferPointer to bytes to write.
countNumber of bytes in buffer.
Returns
Number of bytes consumed.

The documentation for this class was generated from the following files: