| 133 | } |
| 134 | |
| 135 | void ZmqLogger::Path(std::string new_path) |
| 136 | { |
| 137 | // Update path |
| 138 | file_path = new_path; |
| 139 | |
| 140 | // Close file (if already open) |
| 141 | if (log_file.is_open()) |
| 142 | log_file.close(); |
| 143 | |
| 144 | // Open file (write + append) |
| 145 | log_file.open (file_path.c_str(), std::ios::out | std::ios::app); |
| 146 | |
| 147 | // Get current time and log first message |
| 148 | std::time_t now = std::time(0); |
| 149 | std::tm* localtm = std::localtime(&now); |
| 150 | log_file << "------------------------------------------" << std::endl; |
| 151 | log_file << "libopenshot logging: " << std::asctime(localtm); |
| 152 | log_file << "------------------------------------------" << std::endl; |
| 153 | } |
| 154 | |
| 155 | void ZmqLogger::Close() |
| 156 | { |