F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
LogFile.hpp
Go to the documentation of this file.
1 // \copyright
2 // Copyright 2009-2015, by the California Institute of Technology.
3 // ALL RIGHTS RESERVED. United States Government Sponsorship
4 // acknowledged.
5 
6 #ifndef SVCLOGFILE_HPP_
7 #define SVCLOGFILE_HPP_
8 
10 #include <Os/File.hpp>
11 #include <Os/FileSystem.hpp>
12 
13 namespace Svc {
14 
20 
21 struct LogFile {
24  LogFile();
25 
28  ~LogFile();
29 
30  // ----------------------------------------------------------------------
31  // Member Functions
32  // ----------------------------------------------------------------------
33 
41  bool set_log_file(const char* fileName, const FwSizeType maxSize, const FwSizeType maxBackups = 10);
42 
49  bool write_to_log(const char* const buf, const FwSizeType size);
50 
51  // ----------------------------------------------------------------------
52  // Member Variables
53  // ----------------------------------------------------------------------
54 
55  // The name of the file to text logs to:
57 
58  // The file to write text logs to:
60 
61  // The max size of the text log file:
63 
64  // True if there is currently an open file to write text logs to:
65  bool m_openFile;
66 
67  // Current size of the file:
69 };
70 
71 } // namespace Svc
72 #endif /* SVCLOGFILEL_HPP_ */
bool write_to_log(const char *const buf, const FwSizeType size)
Write the passed buf to the log if possible.
Definition: LogFile.cpp:34
LogFile()
Constructor.
Definition: LogFile.cpp:21
PlatformSizeType FwSizeType
LogFile struct.
Definition: LogFile.hpp:21
bool m_openFile
Definition: LogFile.hpp:65
Os::File m_file
Definition: LogFile.hpp:59
bool set_log_file(const char *fileName, const FwSizeType maxSize, const FwSizeType maxBackups=10)
Set log file and max size.
Definition: LogFile.cpp:69
FwSizeType m_maxFileSize
Definition: LogFile.hpp:62
RateGroupDivider component implementation.
FwSizeType m_currentFileSize
Definition: LogFile.hpp:68
~LogFile()
Destructor.
Definition: LogFile.cpp:23
Fw::FileNameString m_fileName
Definition: LogFile.hpp:56