81 size_t nwr = fwrite( data.get(),
sizeof(
char), N,
m_fout);
83 if(nwr != N*
sizeof(
char))
85 std::cerr <<
"logFileRaw::writeLog: Error by fwrite. At: " << __FILE__ <<
" " << __LINE__ <<
"\n";
86 std::cerr <<
"logFileRaw::writeLog: errno says: " << strerror(errno) <<
"\n";
121 m_fout = fopen(fname.c_str(),
"wb");
125 std::cerr <<
"logFileRaw::createFile: Error by fopen. At: " << __FILE__ <<
" " << __LINE__ <<
"\n";
126 std::cerr <<
"logFileRaw::createFile: errno says: " << strerror(errno) <<
"\n";
127 std::cerr <<
"logFileRaw::createFile: fname = " << fname <<
"\n";
std::string m_logName
The base name for the log files.
std::string logExt()
Get the log extension.
std::string m_logPath
The base path for the log files.
logFileRaw()
Default constructor.
int close()
Close the file pointer.
size_t m_maxLogSize
The maximum file size in bytes. Default is 10 MB.
std::string m_logExt
The extension for the log files.
int createFile(flatlogs::timespecX &ts)
Create a new file.
std::string logName()
Get the name.
int writeLog(flatlogs::bufferPtrT &data)
Write a log entry to the file.
size_t maxLogSize()
Get the maximum file size.
int flush()
Flush the stream.
FILE * m_fout
The file pointer.
std::string logPath()
Get the path.
size_t m_currFileSize
The current file size.
static size_t totalSize(bufferPtrT &logBuffer)
Get the total size of the log entry, including the message buffer.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
static int timespec(bufferPtrT &logBuffer, const timespecX &ts)
Set the timespec of a log entry.
A fixed-width timespec structure.
int timeStamp(std::string &tstamp)
Get the filename timestamp for this timespecX.