F´ Flight Software - C/C++ Documentation  devel
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 
9 #include <Fw/Types/String.hpp>
10 #include <Os/File.hpp>
11 #include <Os/FileSystem.hpp>
12 
13 
14 namespace Svc {
15 
21 
22  struct LogFile {
23 
26  LogFile();
27 
30  ~LogFile();
31 
32  // ----------------------------------------------------------------------
33  // Member Functions
34  // ----------------------------------------------------------------------
35 
43  bool set_log_file(const char* fileName, const U32 maxSize, const U32 maxBackups = 10);
44 
51  bool write_to_log(const char *const buf, const U32 size);
52 
53  // ----------------------------------------------------------------------
54  // Member Variables
55  // ----------------------------------------------------------------------
56 
57  // The name of the file to text logs to:
59 
60  // The file to write text logs to:
62 
63  // The max size of the text log file:
65 
66  // True if there is currently an open file to write text logs to:
67  bool m_openFile;
68 
69  // Current size of the file:
71  };
72 
73 }
74 #endif /* SVCLOGFILEL_HPP_ */
LogFile struct.
Definition: LogFile.hpp:22
~LogFile()
Destructor.
Definition: LogFile.cpp:28
Os::File m_file
Definition: LogFile.hpp:61
U32 m_currentFileSize
Definition: LogFile.hpp:70
LogFile()
Constructor.
Definition: LogFile.cpp:22
bool set_log_file(const char *fileName, const U32 maxSize, const U32 maxBackups=10)
Set log file and max size.
Definition: LogFile.cpp:81
bool write_to_log(const char *const buf, const U32 size)
Write the passed buf to the log if possible.
Definition: LogFile.cpp:40
bool m_openFile
Definition: LogFile.hpp:67
U32 m_maxFileSize
Definition: LogFile.hpp:64
Fw::String m_fileName
Definition: LogFile.hpp:58