MCPcopy Create free account
hub / github.com/apache/impala / AppendEntry

Method AppendEntry

be/src/util/simple-logger.cc:100–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100Status SimpleLogger::AppendEntry(const std::string& entry) {
101 DCHECK(initialized_);
102 lock_guard<mutex> l(log_file_lock_);
103 if (num_log_file_entries_ >= max_entries_per_file_) {
104 num_log_file_entries_ = 0;
105 // The log file is generated from a prefix and the timestamp in milliseconds. If
106 // the timestamp hasn't changed, then we continue logging to the same file. In that
107 // case, there is no need to enforce the limit on the number of log files.
108 string next_log_file_name = GenerateLogFileName();
109 if (next_log_file_name != log_file_name_) {
110 log_file_name_ = next_log_file_name;
111 RETURN_IF_ERROR(FlushInternal());
112 RotateLogFiles();
113 }
114 }
115 if (!log_file_.is_open()) return Status("Log file is not open: " + log_file_name_);
116 // Not std::endl, since that causes an implicit flush
117 log_file_ << entry << "\n";
118 ++num_log_file_entries_;
119 return Status::OK();
120}
121
122Status SimpleLogger::Flush() {
123 DCHECK(initialized_);

Callers 5

AppendAuditEntryMethod · 0.80
AppendLineageEntryMethod · 0.80
ArchiveQueryMethod · 0.80
WriteMethod · 0.80
TEST_FFunction · 0.80

Calls 3

OKFunction · 0.85
StatusClass · 0.70
is_openMethod · 0.45

Tested by 1

TEST_FFunction · 0.64