// Labels takes label structs, filters the ones that have their key start with the
// string `labels.` and their value type set to string type. It then wraps those
// key/value pairs in a top-level `labels` namespace.
Labels takes label structs, filters the ones that have their key start with the
string `labels.` and their value type set to string type. It then wraps those
key/value pairs in a top-level `labels` namespace.
// Labels takes label structs filters the ones that have their key start with the // string ` labels . ` and their value type set to string type . It then wraps those // key / value pairs in a top - level ` labels ` namespace .
func (e *Event) Labels(labels ...*label) *zerolog.Event {
	lbls := newLabels()
	lbls.mutex.Lock()
	for i := range labels {
		if isLabelEvent(labels[i]) {
			lbls.store[strings.Replace(labels[i].key, "labels.", "", 1)] = labels[i].value
		}
	}
	lbls.mutex.Unlock()
	return e.Event.Dict("logging.googleapis.com/labels", zerolog.Dict().Fields(lbls.store))
}
func ( e * Event ) Labels ( labels ... * label ) * zerolog . Event { lbls := newLabels ( ) lbls . mutex . Lock ( ) for i := range labels { if isLabelEvent ( labels [ i ] ) { lbls . store [ strings . Replace ( labels [ i ] . key , " " , " " , 1 ) ] = labels [ i ] . value } } lbls . mutex . Unlock ( ) return e . Event . Dict ( " " , zerolog . Dict ( ) . Fields ( lbls . store ) ) }
Labels takes label structs, filters the ones that have their key start with the
string `labels.` and their value type set to string type.
Labels takes label structs filters the ones that have their key start with the string ` labels . ` and their value type set to string type .