-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Problem
Metadata is typed as List(#(String, String)), which forces every call site to manually convert non-string values:
birch.debug_m("Found test files", [
#("count", int.to_string(list.length(files))),
])This is verbose and repetitive, especially for Int, Float, and Bool values that appear frequently in structured logging.
Proposal
Option A — Helper function (minimal, non-breaking):
pub fn meta(key: String, value: a) -> #(String, String) {
#(key, string.inspect(value))
}
// Usage:
birch.debug("Found files", [birch.meta("count", 42)])Option B — Sum type for values (richer, breaking):
pub type MetadataValue {
StringVal(String)
IntVal(Int)
FloatVal(Float)
BoolVal(Bool)
}
pub type Metadata = List(#(String, MetadataValue))This would let JSON and console handlers format values with proper types rather than everything being a string.
Option C — Both: add the meta helper now (non-breaking), consider the sum type for a future major version.
Context
In real-world usage (ccl_gleam test runner), nearly every metadata value requires an explicit int.to_string or similar conversion, adding noise to every log call.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request