@@ -138,7 +138,11 @@ type (
138138 fieldsFromCtxCallMetaFn func (ctx context.Context , c interceptors.CallMeta ) Fields
139139)
140140
141- // WithFieldsFromContext allows overriding existing or adding extra fields to all log messages per given context
141+ // WithFieldsFromContext allows overriding existing or adding extra fields to all log messages per given context.
142+ // If called multiple times, it overwrites the existing FieldsFromContext/WithFieldsFromContextAndCallMeta function.
143+ // If you need to use multiple FieldsFromContext functions then you should combine them in a wrapper fieldsFromCtxFn.
144+ // Only one of WithFieldsFromContextAndCallMeta or WithFieldsFromContext should
145+ // be used, using both will result in the last one overwriting the previous.
142146func WithFieldsFromContext (f fieldsFromCtxFn ) Option {
143147 return func (o * options ) {
144148 o .fieldsFromCtxCallMetaFn = func (ctx context.Context , _ interceptors.CallMeta ) Fields {
@@ -148,6 +152,10 @@ func WithFieldsFromContext(f fieldsFromCtxFn) Option {
148152}
149153
150154// WithFieldsFromContextAndCallMeta allows overriding existing or adding extra fields to all log messages per given context and interceptor.CallMeta
155+ // If called multiple times, it overwrites the existing FieldsFromContext/WithFieldsFromContextAndCallMeta function.
156+ // If you need to use multiple WithFieldsFromContextAndCallMeta functions then you should combine them in a wrapper fieldsFromCtxCallMetaFn.
157+ // Only one of WithFieldsFromContextAndCallMeta or WithFieldsFromContext should
158+ // be used, using both will result in the last one overwriting the previous.
151159func WithFieldsFromContextAndCallMeta (f fieldsFromCtxCallMetaFn ) Option {
152160 return func (o * options ) {
153161 o .fieldsFromCtxCallMetaFn = f
0 commit comments