Skip to content

lib/log: add log.Object for nested fields, fix logtest.Captured

Administrator requested to merge liblog-object into main

Created by: bobheadxi

Adds a more ergonomic API for creating objects using log fields, for example:

	logger.Error("object of fields",
		log.Object("object",
			log.String("field1", "value"),
			log.String("field2", "value"),
		))

Also fixes logtest.Captured which was re-applying the Attributes namespace. Instead of allowing arbitrary options, just specializes the internal hook behaviour to only allow a single additional core (namely the observer core)

Test plan

Unit tests

Merge request reports

Loading