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:
58
Fw::String
m_fileName
;
59
60
// The file to write text logs to:
61
Os::File
m_file
;
62
63
// The max size of the text log file:
64
U32
m_maxFileSize
;
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:
70
U32
m_currentFileSize
;
71
};
72
73
}
74
#endif
/* SVCLOGFILEL_HPP_ */
File.hpp
FileSystem.hpp
String.hpp
Fw::String
Definition:
String.hpp:17
Os::File
Definition:
File.hpp:214
Svc
Definition:
ActiveRateGroupCfg.hpp:18
Svc::LogFile
LogFile struct.
Definition:
LogFile.hpp:22
Svc::LogFile::~LogFile
~LogFile()
Destructor.
Definition:
LogFile.cpp:28
Svc::LogFile::m_file
Os::File m_file
Definition:
LogFile.hpp:61
Svc::LogFile::m_currentFileSize
U32 m_currentFileSize
Definition:
LogFile.hpp:70
Svc::LogFile::LogFile
LogFile()
Constructor.
Definition:
LogFile.cpp:22
Svc::LogFile::set_log_file
bool set_log_file(const char *fileName, const U32 maxSize, const U32 maxBackups=10)
Set log file and max size.
Definition:
LogFile.cpp:81
Svc::LogFile::write_to_log
bool write_to_log(const char *const buf, const U32 size)
Write the passed buf to the log if possible.
Definition:
LogFile.cpp:40
Svc::LogFile::m_openFile
bool m_openFile
Definition:
LogFile.hpp:67
Svc::LogFile::m_maxFileSize
U32 m_maxFileSize
Definition:
LogFile.hpp:64
Svc::LogFile::m_fileName
Fw::String m_fileName
Definition:
LogFile.hpp:58
Svc
ActiveTextLogger
LogFile.hpp
Generated by
1.9.1