|
5 | 5 | Fixes [1682](https://github.com/open-telemetry/opentelemetry-rust/issues/1682). |
6 | 6 | "spec_unstable_logs_enabled" feature now do not suppress logs for other layers. |
7 | 7 |
|
| 8 | +The special treatment of the "message" field has been extended when recording |
| 9 | +string values. With this change, when a log is emitted with a field named |
| 10 | +"message" (and string value), its value is directly assigned to the LogRecord’s |
| 11 | +body rather than being stored as an attribute named "message". This offers a |
| 12 | +slight performance improvement over previous. |
| 13 | + |
| 14 | +For example, the below will now produce LogRecord with the message value |
| 15 | +populated as LogRecord's body: |
| 16 | + |
| 17 | +```rust |
| 18 | +error!( name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", message = "This is an example message"); |
| 19 | +``` |
| 20 | + |
| 21 | +Previously, Body was only populated when the below style was used. |
| 22 | + |
| 23 | +```rust |
| 24 | +error!( name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", "This is an example message"); |
| 25 | +``` |
| 26 | + |
| 27 | +This style, while slightly slower, should still be used when the value is not a |
| 28 | +simple string, but require format arguments as in the below example. |
| 29 | + |
| 30 | +```rust |
| 31 | +error!( name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", "This is an example message with format arguments {} and {}", "foo", "bar"); |
| 32 | +``` |
| 33 | + |
8 | 34 | ## 0.28.1 |
9 | 35 |
|
10 | 36 | Released 2025-Feb-12 |
|
0 commit comments