F´ Flight Software - C/C++ Documentation  devel
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 U32 maxSize, const U32 maxBackups=10)
 Set log file and max size. More...
 
bool write_to_log (const char *const buf, const U32 size)
 Write the passed buf to the log if possible. More...
 

Public Attributes

Fw::String m_fileName
 
Os::File m_file
 
U32 m_maxFileSize
 
bool m_openFile
 
U32 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 22 of file LogFile.hpp.

Constructor & Destructor Documentation

◆ LogFile()

Svc::LogFile::LogFile ( )

Constructor.

Definition at line 22 of file LogFile.cpp.

◆ ~LogFile()

Svc::LogFile::~LogFile ( )

Destructor.

Definition at line 28 of file LogFile.cpp.

Member Function Documentation

◆ set_log_file()

bool Svc::LogFile::set_log_file ( const char *  fileName,
const U32  maxSize,
const U32  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 81 of file LogFile.cpp.

◆ write_to_log()

bool Svc::LogFile::write_to_log ( const char *const  buf,
const U32  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 40 of file LogFile.cpp.

Member Data Documentation

◆ m_currentFileSize

U32 Svc::LogFile::m_currentFileSize

Definition at line 70 of file LogFile.hpp.

◆ m_file

Os::File Svc::LogFile::m_file

Definition at line 61 of file LogFile.hpp.

◆ m_fileName

Fw::String Svc::LogFile::m_fileName

Definition at line 58 of file LogFile.hpp.

◆ m_maxFileSize

U32 Svc::LogFile::m_maxFileSize

Definition at line 64 of file LogFile.hpp.

◆ m_openFile

bool Svc::LogFile::m_openFile

Definition at line 67 of file LogFile.hpp.


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