22 if (log_updater ==
nullptr) {
25 if (filename.size() == 0) {
29 log_updater->mutex.lock();
30 std::list<LogEntry>::iterator
it;
31 for (
it = log_updater->log_list.begin();
it != log_updater->log_list.end();
it++)
33 if (
it->logInfo.port_complete == portname)
37 if (
file1.is_open() ==
false) {log_updater->mutex.unlock();
return false;}
38 std::vector<MessageEntry>::iterator
it1;
39 for (
it1 =
it->entry_list.begin();
it1 !=
it->entry_list.end();
it1++)
41 file1 <<
it1->yarprun_timestamp <<
" " <<
it1->local_timestamp <<
" <" <<
it1->level.toString() <<
"> " <<
it1->text <<
'\n';
46 log_updater->mutex.unlock();
59 file <<
"NULL-DATA" <<
'\n';
70 if (data ==
"NULL-DATA") data=
"";
83 if (log_updater ==
nullptr) {
86 if (filename.size() == 0) {
94 if (
file1.is_open() ==
false) {
102 std::list<LogEntry>::iterator
it;
105 for (
it = log_updater->log_list.begin();
it != log_updater->log_list.end();
it++)
122 std::vector<MessageEntry>::iterator
it1;
123 for (
it1 =
it->entry_list.begin();
it1 !=
it->entry_list.end();
it1++)
129 for (
char s :
it1->text)
138 log_updater->start();
143std::streamoff
get_tag(std::ifstream& file,
const char* tag)
145 std::streamoff pos=file.tellg();
148 for (
int i = 0; i <
tag_size + 2; i++) {
151 std::streamoff
off=0;
156 if (file.good()==
false)
161 if (
strcmp(buff, tag) == 0) {
174 if (log_updater ==
nullptr) {
177 if (filename.size() == 0) {
184 file1.
open(filename.c_str(),std::ifstream::binary);
185 if (
file1.is_open() ==
false) {
200 log_updater->log_list.clear();
251 log_updater->log_list.push_back(
l_tmp);
256 log_updater->start();
std::streamoff get_tag(std::ifstream &file, const char *tag)
void SaveToFile(std::ofstream &file, unsigned int data)
void LoadFromFile(std::ifstream &file, std::string &data)
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
T * read(bool shouldWait=true) override
Read an available object from the port.
bool load_all_logs_from_file(std::string filename)
bool save_all_logs_to_file(std::string filename)
bool export_log_to_text_file(std::string filename, std::string portname)
An interface to the operating system, including Port based communication.