API
 
Loading...
Searching...
No Matches
libXWCTest::loggerTest::logFileRawTest::logFileRawTest Class Reference
Inheritance diagram for libXWCTest::loggerTest::logFileRawTest::logFileRawTest:
Inheritance graph
Collaboration diagram for libXWCTest::loggerTest::logFileRawTest::logFileRawTest:
Collaboration graph

Public Member Functions

 logFileRawTest ()
 
 logFileRawTest (const std::string &lp)
 
mx::error_t test_createFile (flatlogs::timespecX &ts)
 
mx::error_t logPath (const std::string &newPath)
 Set the path.
 
std::string logPath ()
 Get the path.
 
mx::error_t logName (const std::string &newName)
 Set the log name.
 
std::string logName ()
 Get the name.
 
mx::error_t logExt (const std::string &newExt)
 Set the log extension.
 
std::string logExt ()
 Get the log extension.
 
mx::error_t maxLogSize (size_t newMaxFileSize)
 Set the maximum file size.
 
size_t maxLogSize ()
 Get the maximum file size.
 
mx::error_t writeLog (flatlogs::bufferPtrT &data)
 Write a log entry to the file.
 
mx::error_t flush ()
 Flush the stream.
 
mx::error_t close ()
 Close the file pointer.
 

Public Attributes

std::string testPath
 

Protected Member Functions

mx::error_t createFile (flatlogs::timespecX &ts)
 Create a new file.
 

Protected Attributes

Configurable Parameters
std::string m_logPath
 The base path for the log files.
 
std::string m_logName
 The base name for the log files.
 
std::string m_logExt
 The extension for the log files.
 
size_t m_maxLogSize
 The maximum file size in bytes. Default is 10 MB.
 
Internal State
FILE * m_fout
 The file pointer.
 
size_t m_currFileSize
 The current file size.
 

Detailed Description

Definition at line 35 of file logFileRaw_test.cpp.

Constructor & Destructor Documentation

◆ logFileRawTest() [1/2]

libXWCTest::loggerTest::logFileRawTest::logFileRawTest::logFileRawTest ( )
inline

◆ logFileRawTest() [2/2]

libXWCTest::loggerTest::logFileRawTest::logFileRawTest::logFileRawTest ( const std::string &  lp)
inlineexplicit

Member Function Documentation

◆ close()

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::close ( )
inherited

Close the file pointer.

Sets m_fout to nullptr after calling fclose regardless of error.

Returns
0 on success
-1 on error

Definition at line 150 of file logFileRaw.hpp.

◆ createFile()

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::createFile ( flatlogs::timespecX ts)
protectedinherited

Create a new file.

Closes the current file if open. Then creates a new file with a name of the form [path]/[name]/YYYY_MM_DD/[name]_YYYYMMDDHHMMSSNNNNNNNNN.[ext]

Returns
0 on success
-1 on error
Parameters
[in]tsA MagAOX timespec, used to set the timestamp

Definition at line 161 of file logFileRaw.hpp.

◆ flush()

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::flush ( )
inherited

Flush the stream.

Calls fflush. See issue #192

Returns
0 on success
-1 on error
Todo:
this probably should be fsync, with appropriate error handling (see fsyncgate) [issue #192]

Definition at line 142 of file logFileRaw.hpp.

◆ logExt() [1/2]

std::string MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::logExt ( )
inherited

Get the log extension.

Returns
the current value of m_logExt.

Definition at line 111 of file logFileRaw.hpp.

◆ logExt() [2/2]

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::logExt ( const std::string &  newExt)
inherited

Set the log extension.

Returns
0 on success
-1 on error
Parameters
[in]newExtthe new value of m_logExt

Definition at line 105 of file logFileRaw.hpp.

◆ logName() [1/2]

std::string MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::logName ( )
inherited

Get the name.

Returns
the current value of _name.

Definition at line 97 of file logFileRaw.hpp.

◆ logName() [2/2]

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::logName ( const std::string &  newName)
inherited

Set the log name.

Returns
0 on success
-1 on error
Parameters
[in]newNamethe new value of m_logName

Definition at line 91 of file logFileRaw.hpp.

◆ logPath() [1/2]

std::string MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::logPath ( )
inherited

Get the path.

Returns
the current value of m_logPath.

Definition at line 83 of file logFileRaw.hpp.

◆ logPath() [2/2]

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::logPath ( const std::string &  newPath)
inherited

Set the path.

Returns
0 on success
-1 on error
Parameters
[in]newPaththe new value of _path

Definition at line 77 of file logFileRaw.hpp.

◆ maxLogSize() [1/2]

size_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::maxLogSize ( )
inherited

Get the maximum file size.

Returns
the current value of m_maxLogSize

Definition at line 125 of file logFileRaw.hpp.

◆ maxLogSize() [2/2]

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::maxLogSize ( size_t  newMaxFileSize)
inherited

Set the maximum file size.

Returns
0 on success
-1 on error
Parameters
[in]newMaxFileSizethe new value of _maxLogSize

Definition at line 119 of file logFileRaw.hpp.

◆ test_createFile()

mx::error_t libXWCTest::loggerTest::logFileRawTest::logFileRawTest::test_createFile ( flatlogs::timespecX ts)
inline

◆ writeLog()

mx::error_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::writeLog ( flatlogs::bufferPtrT data)
inherited

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.

Returns
0 on success
-1 on error
Parameters
[in]datathe log entry to write to disk

Definition at line 134 of file logFileRaw.hpp.

Member Data Documentation

◆ m_currFileSize

size_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::m_currFileSize
protectedinherited

The current file size.

Definition at line 56 of file logFileRaw.hpp.

◆ m_fout

FILE* MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::m_fout
protectedinherited

The file pointer.

Definition at line 54 of file logFileRaw.hpp.

◆ m_logExt

std::string MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::m_logExt
protectedinherited

The extension for the log files.

Definition at line 45 of file logFileRaw.hpp.

◆ m_logName

std::string MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::m_logName
protectedinherited

The base name for the log files.

Definition at line 44 of file logFileRaw.hpp.

◆ m_logPath

std::string MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::m_logPath
protectedinherited

The base path for the log files.

Definition at line 43 of file logFileRaw.hpp.

◆ m_maxLogSize

size_t MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY >::m_maxLogSize
protectedinherited

The maximum file size in bytes. Default is 10 MB.

Definition at line 47 of file logFileRaw.hpp.

◆ testPath

std::string libXWCTest::loggerTest::logFileRawTest::logFileRawTest::testPath

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