|
| | LogFile () |
| | Constructor, initializes the consumer thread. More...
|
| |
| bool | openFile (const std::string &fileName, const std::string &timeFormat=ISO8086A, const std::string &contentFormat=" ") |
| | Open a log file. More...
|
| |
| bool | isOpen () |
| | Get the status of whether the log file is open. More...
|
| |
| std::string | getFileName () |
| | Get the file name opened by the object. More...
|
| |
| bool | closeFile (const bool &del=false) |
| | Close the log file opened by the object. More...
|
| |
| void | writeLog (const std::string &data) |
| | Write a line of log. More...
|
| |
| bool | clearLog () |
| | Clear all logs. More...
|
| |
| bool | deleteLogByTime (const std::string &date1="1", const std::string &date2="2") |
| | Delete logs within a specified time interval. More...
|
| |
| | ~LogFile () |
| | The destructor writes the log and then closes the consumer thread. More...
|
| |
|
| bool | openFile (const std::string &fileName, const bool &create=true, const int &multiple=0, const size_t &size=0, const mode_t &mode=0666) |
| | Open a file. More...
|
| |
| bool | closeFile (const bool &del=false) |
| | Close the opened file. More...
|
| |
| | ~File () |
| | Destructor. More...
|
| |
| bool | isOpen () |
| | Check if the object has opened a file. More...
|
| |
| bool | isBinary () |
| | Check if the object has opened the file in binary mode. More...
|
| |
| std::string | getFileName () |
| | Get the name of the opened file. More...
|
| |
| uint64_t | getFileLine () |
| | Get the number of lines in the opened file. More...
|
| |
| size_t | getFileSize () |
| | Get the size of the file opened in binary mode. More...
|
| |
| size_t | getSize1 () |
| | Get the size of the file opened in binary mode in memory. More...
|
| |
| bool | lockMemory () |
| | Read data from disk into memory. More...
|
| |
| bool | unlockMemory (const bool &rec=false) |
| | Write data from memory to disk. More...
|
| |
| int | findC (const std::string &targetString, const int linePos=1) |
| | Find a line. More...
|
| |
| bool | appendLineC (const std::string &data, const int &linePos=0) |
| | Insert a line. More...
|
| |
| bool | deleteLineC (const int &linePos=0) |
| | Delete a line. More...
|
| |
| bool | deleteAllC () |
| | Delete all lines. More...
|
| |
| bool | chgLineC (const std::string &data, const int &linePos=0) |
| | Modify a line. More...
|
| |
| bool | readLineC (std::string &data, const int linePos) |
| | Read a single line. More...
|
| |
| std::string & | readC (std::string &data, const int &linePos, const int &num) |
| | Read multiple lines. More...
|
| |
| std::string & | readAllC (std::string &data) |
| | Read all lines. More...
|
| |
| bool | readC (char *data, const size_t &pos, const size_t &size) |
| | Read a data block. More...
|
| |
| bool | writeC (const char *data, const size_t &pos, const size_t &size) |
| | Write a data block. More...
|
| |
| void | formatC () |
| | Format the data. More...
|
| |
| int | find (const std::string &targetString, const int linePos=1) |
| | Find a line. More...
|
| |
| bool | appendLine (const std::string &data, const int &linePos=0) |
| | Insert a line. More...
|
| |
| bool | deleteLine (const int &linePos=0) |
| | Delete a line. More...
|
| |
| bool | deleteAll () |
| | Delete all lines. More...
|
| |
| bool | chgLine (const std::string &data, const int &linePos=0) |
| | Modify a line. More...
|
| |
| bool | readLine (std::string &data, const int linePos) |
| | Read a single line. More...
|
| |
| std::string & | read (std::string &data, const int &linePos, const int &num) |
| | Read multiple lines. More...
|
| |
| std::string & | readAll (std::string &data) |
| | Read all lines. More...
|
| |
| bool | read (char *data, const size_t &pos, const size_t &size) |
| | Read a data block. More...
|
| |
| bool | write (const char *data, const size_t &pos, const size_t &size) |
| | Write a data block. More...
|
| |
| void | format () |
| | Format the data. More...
|
| |
| std::mutex | che |
| |
| static std::mutex | l1 |
| |
static std::unordered_map
< std::string, FileThreadLock > | fl2 |
| |
Log file operation class.
- Note
- The log reading/writing of this class is thread-safe due to inheritance from the File class