Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion logger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "logger"
version = "0.1.0"
version = "0.1.1"
edition = "2024"

[dependencies]
Expand Down
8 changes: 4 additions & 4 deletions logger/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/// the host application's observability tools.
///
/// Each log message is automatically prefixed with the crate and component
/// name (e.g., `my_crate:http_client`) to help identify the source.
/// name (e.g., `my_crate`) to help identify the source.
///
/// # Example
/// ```ignore
/// let logger = Logger::new("my_crate", "http_client");
/// let logger = Logger::new("my_crate");
/// logger.info("request sent", None);
/// logger.error("request failed", Some(json!({ "code": 500 })));
/// ```
Expand All @@ -21,9 +21,9 @@ pub struct Logger {

impl Logger {
/// Creates a new logger instance with a given crate and component name.
pub fn new(crate_name: &str, name: &str) -> Self {
pub fn new(prefix: &str) -> Self {
Self {
prefix: format!("{crate_name}:{name}"),
prefix: prefix.to_owned(),
}
}

Expand Down