Map of log entries by application name, mapping both to files and to loaded buffers. More...
#include <logMap.hpp>

Public Types | |
| typedef file::stdSubDir< verboseT > | stdSubDirT |
| typedef file::stdFileName< verboseT > | stdFileNameT |
| typedef std::map< std::string, std::set< stdFileNameT, file::compStdFileName< stdFileNameT > > > | appToFileMapT |
| The app-name to file-name map type, for sorting the input files by application. | |
| typedef std::map< std::string, logInMemory > | appToBufferMapT |
| The app-name to buffer map type, for looking up the currently loaded logs for a given app. | |
Public Member Functions | |
| mx::error_t | addFileListToFileMap (const std::string &dev, const std::vector< std::string > &flist, size_t n0, size_t nf) |
| Add a list of files to the file map. | |
| mx::error_t | loadAppToFileMap (const std::string &dir, const std::string &dev, const std::string &ext, const stdFileNameT &firstFile, const stdFileNameT &lastFile) |
| Get log file names in a directory and distribute them into the map by app-name. | |
| int | getPriorLog (char *&logBefore, const std::string &appName, const flatlogs::eventCodeT &ev, const flatlogs::timespecX &ts, char *hint=0) |
| Get the log for an event code which is the first prior to the supplied time. | |
| int | getNextLog (char *&logAfter, char *logCurrent, const std::string &appName) |
| Get the next log with the same event code which is after the supplied time. | |
| int | getNearestLogs (flatlogs::bufferPtrT &logBefore, flatlogs::bufferPtrT &logAfter, const std::string &appName) |
| int | loadFiles (const std::string &appName, const flatlogs::timespecX &startTime) |
Public Attributes | |
| appToFileMapT | m_appToFileMap |
| appToBufferMapT | m_appToBufferMap |
Map of log entries by application name, mapping both to files and to loaded buffers.
Definition at line 50 of file logMap.hpp.
| typedef std::map<std::string, logInMemory> MagAOX::logger::logMap< verboseT >::appToBufferMapT |
The app-name to buffer map type, for looking up the currently loaded logs for a given app.
Definition at line 60 of file logMap.hpp.
| typedef std::map<std::string, std::set<stdFileNameT, file::compStdFileName<stdFileNameT> > > MagAOX::logger::logMap< verboseT >::appToFileMapT |
The app-name to file-name map type, for sorting the input files by application.
Definition at line 57 of file logMap.hpp.
| typedef file::stdFileName<verboseT> MagAOX::logger::logMap< verboseT >::stdFileNameT |
Definition at line 54 of file logMap.hpp.
| typedef file::stdSubDir<verboseT> MagAOX::logger::logMap< verboseT >::stdSubDirT |
Definition at line 53 of file logMap.hpp.
| mx::error_t MagAOX::logger::logMap< verboseT >::addFileListToFileMap | ( | const std::string & | dev, |
| const std::vector< std::string > & | flist, | ||
| size_t | n0, | ||
| size_t | nf | ||
| ) |
Add a list of files to the file map.
This is a worker function for loadAppToFileMap
| [in] | dev | the device name to add |
| [in] | flist | the file list from which to add files |
| [in] | n0 | the first entry in the file list to add |
| [in] | nf | one past the last entry in the file list to add, e.g. flist.size() |
Definition at line 118 of file logMap.hpp.
References MagAOX::file::stdFileName< verboseT >::appName(), MagAOX::file::stdFileName< verboseT >::valid(), and MagAOX::xwcException::what().
| int MagAOX::logger::logMap< verboseT >::getNearestLogs | ( | flatlogs::bufferPtrT & | logBefore, |
| flatlogs::bufferPtrT & | logAfter, | ||
| const std::string & | appName | ||
| ) |
| int MagAOX::logger::logMap< verboseT >::getNextLog | ( | char *& | logAfter, |
| char * | logCurrent, | ||
| const std::string & | appName | ||
| ) |
Get the next log with the same event code which is after the supplied time.
| [out] | logAfter | pointer to the first byte of the prior log entry |
| [in] | logCurrent | The log to start from |
| [in] | appName | the name of the app specifying which log to search |
Definition at line 634 of file logMap.hpp.
References flatlogs::logHeader::eventCode(), MagAOX::logger::logInMemory::m_memory, and flatlogs::logHeader::totalSize().
Referenced by MagAOX::logger::getLogContVal(), and MagAOX::logger::getLogStateVal().
| int MagAOX::logger::logMap< verboseT >::getPriorLog | ( | char *& | logBefore, |
| const std::string & | appName, | ||
| const flatlogs::eventCodeT & | ev, | ||
| const flatlogs::timespecX & | ts, | ||
| char * | hint = 0 |
||
| ) |
Get the log for an event code which is the first prior to the supplied time.
| [out] | logBefore | pointer to the first byte of the prior log entry |
| [in] | appName | the name of the app specifying which log to search |
| [in] | ev | the event code to search for |
| [in] | ts | the timestamp to be prior to |
| [in] | hint | [optional] a hint specifying where to start searching. If null search starts at beginning. |
Definition at line 510 of file logMap.hpp.
References flatlogs::logHeader::eventCode(), MagAOX::logger::logInMemory::m_endTime, MagAOX::logger::logInMemory::m_memory, MagAOX::logger::logInMemory::m_startTime, flatlogs::timespecX::time_s, flatlogs::logHeader::timespec(), and flatlogs::logHeader::totalSize().
Referenced by MagAOX::logger::getLogContVal(), and MagAOX::logger::getLogStateVal().
| mx::error_t MagAOX::logger::logMap< verboseT >::loadAppToFileMap | ( | const std::string & | dir, |
| const std::string & | dev, | ||
| const std::string & | ext, | ||
| const stdFileNameT & | firstFile, | ||
| const stdFileNameT & | lastFile | ||
| ) |
Get log file names in a directory and distribute them into the map by app-name.
Finding no logs is not reported as an error (no exception is thrown). You must check the size of m_appToFileMap to check if any files were found.
| [in] | dir | the directory to search for files (contains the dev/YYYY_MM_DD subdirs) |
| [in] | dev | the device name to search for logs of |
| [in] | ext | the extension to search for |
| [in] | firstFile | the first file that needs coverage |
| [in] | lastFile | the last file that needs coverage |
Definition at line 174 of file logMap.hpp.
References MagAOX::file::stdSubDir< verboseT >::addDay(), MagAOX::file::stdFileName< verboseT >::fullName(), MagAOX::file::stdSubDir< verboseT >::path(), MagAOX::file::stdSubDir< verboseT >::subDay(), MagAOX::file::stdFileName< verboseT >::subDir(), flatlogs::timespecX::time_s, MagAOX::file::stdFileName< verboseT >::timestamp(), and MagAOX::file::stdFileName< verboseT >::valid().
Referenced by libXWCTest::loggerTest::logMapTest::TEST_CASE(), libXWCTest::loggerTest::logMapTest::TEST_CASE(), and libXWCTest::loggerTest::logMapTest::TEST_CASE().
| int MagAOX::logger::logMap< verboseT >::loadFiles | ( | const std::string & | appName, |
| const flatlogs::timespecX & | startTime | ||
| ) |
| appName | MagAO-X app name for which to load files |
Definition at line 682 of file logMap.hpp.
| appToBufferMapT MagAOX::logger::logMap< verboseT >::m_appToBufferMap |
Definition at line 64 of file logMap.hpp.
| appToFileMapT MagAOX::logger::logMap< verboseT >::m_appToFileMap |
Definition at line 62 of file logMap.hpp.
Referenced by libXWCTest::loggerTest::logMapTest::TEST_CASE(), libXWCTest::loggerTest::logMapTest::TEST_CASE(), and libXWCTest::loggerTest::logMapTest::TEST_CASE().