| 45 | const ptime EPOCH = time_from_string("1970-01-01 00:00:00.000"); |
| 46 | |
| 47 | Status InitLoggingDir(const string& log_dir) { |
| 48 | if (!exists(log_dir)) { |
| 49 | LOG(INFO) << "Log directory does not exist, creating: " << log_dir; |
| 50 | try { |
| 51 | create_directories(log_dir); |
| 52 | } catch (const std::exception& e) { // Explicit std:: to distinguish from boost:: |
| 53 | LOG(ERROR) << "Could not create log directory: " |
| 54 | << log_dir << ", " << e.what(); |
| 55 | return Status("Failed to create log directory"); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | if (!is_directory(log_dir)) { |
| 60 | LOG(ERROR) << "Log path is not a directory (" |
| 61 | << log_dir << ")"; |
| 62 | return Status("Log path is not a directory"); |
| 63 | } |
| 64 | return Status::OK(); |
| 65 | } |
| 66 | |
| 67 | string SimpleLogger::GenerateLogFileName() { |
| 68 | stringstream ss; |