Skip to content

Commit

Permalink
🔇 silent changes: add base function #2
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed Dec 14, 2024
1 parent 59eda00 commit 310bdcb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,25 @@ func (m *meta) WithCustomFieldKV(key string, value interface{}) *meta {
return m
}

// WithCustomFieldKVf sets a specific custom field key-value pair for the `meta` instance
// using a formatted value.
//
// This function creates a formatted string value using the provided `format` string and
// `args`. It then calls `WithCustomFieldKV` to add or update the custom field with the
// specified key and the formatted value. The modified `meta` instance is returned for
// method chaining.
//
// Parameters:
// - key: A string representing the key for the custom field.
// - format: A format string to construct the value.
// - args: A variadic list of arguments to be interpolated into the format string.
//
// Returns:
// - A pointer to the modified `meta` instance, enabling method chaining.
func (m *meta) WithCustomFieldKVf(key string, format string, args ...interface{}) *meta {
return m.WithCustomFieldKV(key, fmt.Sprintf(format, args...))
}

// WithCode sets the `code` field of the `header` instance.
//
// This function assigns the provided integer value to the `code` field of the `header`
Expand Down

0 comments on commit 310bdcb

Please sign in to comment.