Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Aug 13, 2024
1 parent 6ee6e31 commit 7280936
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion opentelemetry-appender-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where
if self.enabled(record.metadata()) {
let mut log_record = self.logger.create_log_record();
log_record.set_severity_number(severity_of_level(record.level()));
log_record.set_severity_text(record.level().as_str().into());
log_record.set_severity_text(record.level().as_str());
log_record.set_body(AnyValue::from(record.args().to_string()));
log_record.add_attributes(log_attributes(record.key_values()));
log_record.set_target(record.metadata().target().to_string());
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-appender-tracing/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ where
log_record.set_target(meta.target().to_string());
log_record.set_event_name(meta.name());
log_record.set_severity_number(severity_of_level(meta.level()));
log_record.set_severity_text(meta.level().as_str().into());
log_record.set_severity_text(meta.level().as_str());
let mut visitor = EventVisitor::new(&mut log_record);
#[cfg(feature = "experimental_metadata_attributes")]
visitor.visit_experimental_metadata(meta);
Expand Down
10 changes: 5 additions & 5 deletions opentelemetry-sdk/benches/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn logging_comparable_to_appender(c: &mut Criterion) {
log_record.set_target("my-target".to_string());
log_record.set_event_name("CheckoutFailed");
log_record.set_severity_number(Severity::Warn);
log_record.set_severity_text("WARN".into());
log_record.set_severity_text("WARN");
log_record.add_attribute("book_id", "12345");
log_record.add_attribute("book_title", "Rust Programming Adventures");
log_record.add_attribute("message", "Unable to process checkout.");
Expand Down Expand Up @@ -275,7 +275,7 @@ fn criterion_benchmark(c: &mut Criterion) {
log_record.set_timestamp(now);
log_record.set_observed_timestamp(now);
log_record.set_severity_number(Severity::Warn);
log_record.set_severity_text(Severity::Warn.name().into());
log_record.set_severity_text(Severity::Warn.name());
logger.emit(log_record);
});

Expand All @@ -285,7 +285,7 @@ fn criterion_benchmark(c: &mut Criterion) {
log_record.set_timestamp(now);
log_record.set_observed_timestamp(now);
log_record.set_severity_number(Severity::Warn);
log_record.set_severity_text(Severity::Warn.name().into());
log_record.set_severity_text(Severity::Warn.name());
log_record.add_attribute("name", "my-event-name");
log_record.add_attribute("event.id", 20);
log_record.add_attribute("user.name", "otel");
Expand All @@ -299,7 +299,7 @@ fn criterion_benchmark(c: &mut Criterion) {
log_record.set_timestamp(now);
log_record.set_observed_timestamp(now);
log_record.set_severity_number(Severity::Warn);
log_record.set_severity_text(Severity::Warn.name().into());
log_record.set_severity_text(Severity::Warn.name());
log_record.add_attribute("name", "my-event-name");
log_record.add_attribute("event.id", 20);
log_record.add_attribute("user.name", "otel");
Expand Down Expand Up @@ -338,7 +338,7 @@ fn criterion_benchmark(c: &mut Criterion) {
log_record.set_timestamp(now);
log_record.set_observed_timestamp(now);
log_record.set_severity_number(Severity::Warn);
log_record.set_severity_text(Severity::Warn.name().into());
log_record.set_severity_text(Severity::Warn.name());
log_record.add_attributes(attributes.clone());
logger.emit(log_record);
});
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/logs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mod tests {
let logger = logger_provider.logger("test-logger");
let mut log_record = logger.create_log_record();
log_record.set_severity_number(Severity::Error);
log_record.set_severity_text("Error".into());
log_record.set_severity_text("Error");

// Adding attributes using a vector with explicitly constructed Key and AnyValue objects.
log_record.add_attributes(vec![
Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-stdout/src/logs/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ impl From<opentelemetry_sdk::export::logs::LogData> for LogRecord {
.collect::<Vec<KeyValue>>(); // Collect into a Vec<KeyValue>s

#[cfg(feature = "populate-logs-event-name")]
if let Some(event_name) = &value.record.event_name {
if let Some(event_name) = value.record.event_name {
let mut attributes_with_name = attributes;
attributes_with_name.push(KeyValue::from((
"name".into(),
opentelemetry::Value::String(event_name.clone().into()),
opentelemetry::Value::String(event_name.into()),
)));
attributes_with_name
} else {
Expand Down

0 comments on commit 7280936

Please sign in to comment.