Skip to content

Commit a97120d

Browse files
author
Joshua Tracey
committed
fix: duplicate message in logs
1 parent 06b3d20 commit a97120d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "scribe-rust"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
edition = "2021"
55
license = "MIT"
66
authors = ["[email protected]"]

src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,19 @@ where
173173
};
174174

175175
if level >= self.logger.level {
176+
// Initialize the visitor to capture event fields
176177
let mut visitor = FieldVisitor::new();
177178
event.record(&mut visitor);
179+
180+
// Attempt to retrieve the "message" field
178181
let message = visitor
179182
.fields
180183
.get("message")
181184
.and_then(|v| v.as_str())
182185
.unwrap_or(event.metadata().name());
183186

184-
let json_fields = json!(visitor.fields);
185-
self.logger
186-
.log(level, &format!("{} {}", message, json_fields));
187+
// Log the message without the JSON fields
188+
self.logger.log(level, message);
187189
}
188190
}
189191
}

0 commit comments

Comments
 (0)