|
MagAO-X
|
||||
|
A class to manage raw binary log files. More...
#include <logFileRaw.hpp>

Public Member Functions | |
| logFileRaw () | |
| Default constructor. More... | |
| ~logFileRaw () | |
| Destructor. More... | |
| int | logPath (const std::string &newPath) |
| Set the path. More... | |
| std::string | logPath () |
| Get the path. More... | |
| int | logName (const std::string &newName) |
| Set the log name. More... | |
| std::string | logName () |
| Get the name. More... | |
| int | logExt (const std::string &newExt) |
| Set the log extension. More... | |
| std::string | logExt () |
| Get the log extension. More... | |
| int | maxLogSize (size_t newMaxFileSize) |
| Set the maximum file size. More... | |
| size_t | maxLogSize () |
| Get the maximum file size. More... | |
| int | writeLog (flatlogs::bufferPtrT &data) |
| Write a log entry to the file. More... | |
| int | flush () |
| Flush the stream. More... | |
| int | close () |
| Close the file pointer. More... | |
Protected Member Functions | |
| int | createFile (flatlogs::timespecX &ts) |
| Create a new file. More... | |
Protected Attributes | |
Configurable Parameters | |
| std::string | m_logPath {"."} |
| The base path for the log files. More... | |
| std::string | m_logName {"xlog"} |
| The base name for the log files. More... | |
| std::string | m_logExt {MAGAOX_default_logExt} |
| The extension for the log files. More... | |
| size_t | m_maxLogSize {MAGAOX_default_max_logSize} |
| The maximum file size in bytes. Default is 10 MB. More... | |
Internal State | |
| FILE * | m_fout {0} |
| The file pointer. More... | |
| size_t | m_currFileSize {0} |
| The current file size. More... | |
A class to manage raw binary log files.
Manages a binary file containing MagAO-X logs.
The log entries are written as a binary stream of a configurable maximum size. If this size will be exceed by the next entry, then a new file is created.
Filenames have a standard form of: [path]/[name]_YYYYMMDDHHMMSSNNNNNNNNN.[ext] where fields in [] are configurable.
The timestamp is from the first entry of the file.
Definition at line 41 of file logFileRaw.hpp.
|
inline |
|
inline |
|
inline |
Close the file pointer.
Definition at line 272 of file logFileRaw.hpp.
Referenced by ~logFileRaw().
|
inlineprotected |
Create a new file.
Closes the current file if open. Then creates a new file with a name of the form [path]/[name]_YYYYMMDDHHMMSSNNNNNNNNN.[ext]
| [in] | ts | A MagAOX timespec, used to set the timestamp |
Definition at line 281 of file logFileRaw.hpp.
Referenced by writeLog().
|
inline |
|
inline |
Set the log extension.
| [in] | newExt | the new value of m_logExt |
Definition at line 212 of file logFileRaw.hpp.
|
inline |
Get the log extension.
Definition at line 219 of file logFileRaw.hpp.
|
inline |
Set the log name.
| [in] | newName | the new value of m_logName |
Definition at line 199 of file logFileRaw.hpp.
|
inline |
|
inline |
Set the path.
| [in] | newPath | the new value of _path |
Definition at line 186 of file logFileRaw.hpp.
|
inline |
|
inline |
Set the maximum file size.
| [in] | newMaxFileSize | the new value of _maxLogSize |
Definition at line 225 of file logFileRaw.hpp.
|
inline |
Get the maximum file size.
Definition at line 232 of file logFileRaw.hpp.
|
inline |
Write a log entry to the file.
Checks if this write will exceed m_maxLogSize, and if so opens a new file. The new file will have the timestamp of this log entry.
| [in] | data | the log entry to write to disk |
Definition at line 238 of file logFileRaw.hpp.
|
protected |
The current file size.
Definition at line 62 of file logFileRaw.hpp.
Referenced by createFile(), and writeLog().
|
protected |
The file pointer.
Definition at line 60 of file logFileRaw.hpp.
Referenced by close(), createFile(), flush(), and writeLog().
|
protected |
The extension for the log files.
Definition at line 51 of file logFileRaw.hpp.
Referenced by createFile(), and logExt().
|
protected |
The base name for the log files.
Definition at line 50 of file logFileRaw.hpp.
Referenced by createFile(), and logName().
|
protected |
The base path for the log files.
Definition at line 49 of file logFileRaw.hpp.
Referenced by createFile(), and logPath().
|
protected |
The maximum file size in bytes. Default is 10 MB.
Definition at line 53 of file logFileRaw.hpp.
Referenced by maxLogSize(), and writeLog().