Add bind-style context helpers

This commit is contained in:
Nanaloveyuki
2026-05-10 12:12:11 +08:00
parent 2e008b649c
commit a26ec6399c
9 changed files with 86 additions and 0 deletions
+4
View File
@@ -36,6 +36,10 @@ pub fn[S] Logger::with_context_fields(self : Logger[S], fields : Array[Field]) -
}
}
pub fn[S] Logger::bind(self : Logger[S], fields : Array[Field]) -> Logger[ContextSink[S]] {
self.with_context_fields(fields)
}
pub fn[S] Logger::with_filter(self : Logger[S], predicate : (Record) -> Bool) -> Logger[FilterSink[S]] {
{
min_level: self.min_level,