MCPcopy Create free account
hub / github.com/apache/arrow / Log

Method Log

cpp/src/arrow/telemetry/logging.cc:208–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206 : logger_(ot_logger), options_(std::move(options)) {}
207
208 void Log(const util::LogDetails& details) override {
209 if (details.severity < options_.severity_threshold) {
210 return;
211 }
212
213 auto log = logger_->CreateLogRecord();
214 if (log == nullptr) {
215 return;
216 }
217
218 // We set the remaining attributes AFTER the custom attributes in AttributeHolder
219 // because, in the event of key collisions, these should take precedence.
220 log->SetTimestamp(otel::common::SystemTimestamp(details.timestamp));
221 log->SetSeverity(ToOtelSeverity(details.severity));
222
223 auto span_ctx = otel::trace::Tracer::GetCurrentSpan()->GetContext();
224 log->SetSpanId(span_ctx.span_id());
225 log->SetTraceId(span_ctx.trace_id());
226 log->SetTraceFlags(span_ctx.trace_flags());
227
228 log->SetBody(ToOtel(details.message));
229
230 logger_->EmitLogRecord(std::move(log));
231
232 if (details.severity >= options_.flush_severity) {
233 util::Logger::Flush();
234 }
235 }
236
237 bool Flush(std::chrono::microseconds timeout) override {
238 return OtelLoggerProvider::Flush(timeout);

Callers 1

LogFunction · 0.45

Calls 4

ToOtelSeverityFunction · 0.85
ToOtelFunction · 0.85
FlushFunction · 0.85
GetContextMethod · 0.45

Tested by 1

LogFunction · 0.36