Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new Logger:log() method #1005

Merged
merged 4 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions api/include/opentelemetry/logs/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@ class Logger
this->Log(severity, name, "", {}, attributes, {}, {}, {}, std::chrono::system_clock::now());
}

/**
* Writes a log.
* @param severity The severity of the log
* @param name The name of the log
* @param attributes the attributes, stored as a 2D list of key/value pairs, that are associated
lalitb marked this conversation as resolved.
Show resolved Hide resolved
* with the log event
*/
void Log(Severity severity,
lalitb marked this conversation as resolved.
Show resolved Hide resolved
nostd::string_view name,
common::KeyValueIterable &attributes) noexcept
{
this->Log(severity, name, {},
common::KeyValueIterableView<
std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>>({}),
attributes, {}, {}, {}, std::chrono::system_clock::now());
}

/** Trace severity overloads **/

/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/logs/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class Logger final : public opentelemetry::logs::Logger
nostd::string_view body,
const opentelemetry::common::KeyValueIterable &resource,
const opentelemetry::common::KeyValueIterable &attributes,
trace::TraceId trace_id,
trace::SpanId span_id,
opentelemetry::trace::TraceId trace_id,
opentelemetry::trace::SpanId span_id,
trace::TraceFlags trace_flags,
opentelemetry::common::SystemTimestamp timestamp) noexcept override;

Expand Down