F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Svc::LogFile Class Reference

LogFile struct. More...

#include <Svc/ActiveTextLogger/LogFile.hpp>

Public Member Functions

 LogFile ()
 Constructor. More...
 
 ~LogFile ()
 Destructor. More...
 
bool set_log_file (const char *fileName, const FwSizeType maxSize, const FwSizeType maxBackups=10)
 Set log file and max size. More...
 
bool write_to_log (const char *const buf, const FwSizeType size)
 Write the passed buf to the log if possible. More...
 

Public Attributes

Fw::FileNameString m_fileName
 
Os::File m_file
 
FwSizeType m_maxFileSize
 
bool m_openFile
 
FwSizeType m_currentFileSize
 

Detailed Description

LogFile struct.

The object is used for writing to a log file. Making it a struct so all members are public, for ease of use in object composition.

Definition at line 21 of file LogFile.hpp.

Constructor & Destructor Documentation

◆ LogFile()

Svc::LogFile::LogFile ( )

Constructor.

Definition at line 21 of file LogFile.cpp.

◆ ~LogFile()

Svc::LogFile::~LogFile ( )

Destructor.

Definition at line 23 of file LogFile.cpp.

Member Function Documentation

◆ set_log_file()

bool Svc::LogFile::set_log_file ( const char *  fileName,
const FwSizeType  maxSize,
const FwSizeType  maxBackups = 10 
)

Set log file and max size.

Parameters
fileNameThe name of the file to create. Must be less than 80 characters.
maxSizeThe max size of the file
maxBackupsThe max backups for the file. Default: 10
Returns
true if creating the file was successful, false otherwise

Definition at line 69 of file LogFile.cpp.

◆ write_to_log()

bool Svc::LogFile::write_to_log ( const char *const  buf,
const FwSizeType  size 
)

Write the passed buf to the log if possible.

Parameters
bufThe buffer of data to write
sizeThe size of buf
Returns
true if writing to the file was successful, false otherwise

Definition at line 34 of file LogFile.cpp.

Member Data Documentation

◆ m_currentFileSize

FwSizeType Svc::LogFile::m_currentFileSize

Definition at line 68 of file LogFile.hpp.

◆ m_file

Os::File Svc::LogFile::m_file

Definition at line 59 of file LogFile.hpp.

◆ m_fileName

Fw::FileNameString Svc::LogFile::m_fileName

Definition at line 56 of file LogFile.hpp.

◆ m_maxFileSize

FwSizeType Svc::LogFile::m_maxFileSize

Definition at line 62 of file LogFile.hpp.

◆ m_openFile

bool Svc::LogFile::m_openFile

Definition at line 65 of file LogFile.hpp.


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