Skip to content

Commit 2c4cbe2

Browse files
authored
documenting logs bridge api, adding memory exporter (#959)
* implement bridge api * adding logs memory exporter * clarify bridge api not for developers * adding logger provider builder * review feedback * removing Bridge and documenting what a bridge is
1 parent c78c92a commit 2c4cbe2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Logs/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Logs API
2+
3+
This `Logger` API is not designed to be used by application developers, but rather by library developers for the purpose
4+
of integrating existing logging libraries with OpenTelemetry.
5+
6+
## Logging from 3rd party loggers
7+
8+
3rd party loggers should log to OpenTelemetry in accordance with the
9+
[logs bridge API](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md)
10+
specification.
11+
12+
This means that a "log appender" in the 3rd party logging library (sometimes known as a "handler") should:
13+
- accept an `OpenTelemetry\API\Logs\LoggerProviderInterface`, or obtain a globally registered one from `OpenTelemetry\API\Instrumentation\Globals`
14+
- obtain a `Logger` from the logger provider (optionally adding any resources that should be associated with logs emitted)
15+
- convert logs from its own log format into OpenTelemetry's `LogRecord` format
16+
- send the logs to OpenTelemetry via `Logger::logRecord()`
17+
18+
See [monolog-otel-integration](examples/logs/features/monolog-otel-integration.md) for an example.
19+

0 commit comments

Comments
 (0)