Skip to content

Commit 1467d66

Browse files
authored
[EXAMPLES] Use logs API instead of logs bridge API in the example (#2494)
1 parent 0cd3e88 commit 1467d66

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

examples/common/logs_foo_library/foo_library.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ void foo_library()
3232
auto scoped_span = trace::Scope(get_tracer()->StartSpan("foo_library"));
3333
auto ctx = span->GetContext();
3434
auto logger = get_logger();
35-
logger->EmitLogRecord(opentelemetry::logs::Severity::kDebug, "body", ctx.trace_id(),
36-
ctx.span_id(), ctx.trace_flags(),
37-
opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now()));
35+
36+
logger->Debug("body", ctx.trace_id(), ctx.span_id(), ctx.trace_flags());
3837
}

examples/logs_simple/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
21
# Simple Logs Example
32

43
In this example, the application in `main.cc` initializes an
54
`OStreamLogRecordExporter` instance and registers a logger
65
provider, as well as initializes a `StdoutSpanExporter` instance and registers a
7-
tracer provider from the [OpenTelemetry
6+
tracer provider from the [OpenTelemetry C++
87
SDK](https://github.com/open-telemetry/opentelemetry-cpp).
98

10-
The application then calls a `logs_foo_library` which has been instrumented
11-
using the [OpenTelemetry
12-
API](https://github.com/open-telemetry/opentelemetry-cpp/tree/main/api).
13-
Resulting logs and traces are directed to stdout.
9+
The application then calls into
10+
[`logs_foo_library`](https://github.com/open-telemetry/opentelemetry-cpp/blob/main/examples/common/logs_foo_library/foo_library.cc)
11+
which has been instrumented using the [OpenTelemetry Logs
12+
API](../../api/include/opentelemetry/logs/logger.h). Resulting logs and traces
13+
are directed to stdout.
1414

1515
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and
1616
running the example.

0 commit comments

Comments
 (0)