17#include <mx/mxException.hpp>
19#include "../common/exceptions.hpp"
30 int fd = open( lfn.
fullName().c_str(), O_RDONLY );
32 off_t fsz = mx::ioutils::fileSize( fd );
34 std::vector<char> memory( fsz );
36 ssize_t nrd = read( fd, memory.data(), memory.size() );
42 std::cerr << __FILE__ <<
" " << __LINE__ <<
" logInMemory::loadFile(" << lfn.
fullName()
43 <<
") did not read all bytes\n";
53 while( st < memory.size() )
59 if( st != memory.size() )
61 std::cerr << __FILE__ <<
" " << __LINE__ <<
" Possibly corrupt logfile.\n";
75 std::string timestamp;
77 mx::sys::timeStamp( timestamp, ts );
80 std::cerr << __FILE__ <<
" " << __LINE__ <<
" loading: " << lfn.
fullName() <<
" " << timestamp <<
"\n";
91 std::cerr << __FILE__ <<
" " << __LINE__ <<
" overlapping log files!\n";
97 std::cerr << __FILE__ <<
" " << __LINE__ <<
" added before!\n";
104 std::cerr << __FILE__ <<
" " << __LINE__ <<
" gonna append\n";
111 std::cerr << __FILE__ <<
" " << __LINE__ <<
" added after!\n";
117 std::cerr << __FILE__ <<
" " << __LINE__ <<
" Need to implement insert in the middle!\n";
119 std::cerr << startTime.
time_s <<
" " << startTime.
time_ns <<
"\n";
Organize and analyze the name of a standard file name.
mx::error_t fullName(const std::string &fullName)
Sets the full name.
static size_t totalSize(bufferPtrT &logBuffer)
Get the total size of the log entry, including the message buffer.
static int timespec(bufferPtrT &logBuffer, const timespecX &ts)
Set the timespec of a log entry.
Declares and defines the logMap class and related classes.
flatlogs::timespecX m_startTime
int loadFile(file::stdFileName< verboseT > const &lfn)
std::vector< char > m_memory
The buffer holding the log data.
flatlogs::timespecX m_endTime
Map of log entries by application name, mapping both to files and to loaded buffers.
A fixed-width timespec structure.
nanosecT time_ns
Nanoseconds.
secT time_s
Time since the Unix epoch.