Reflect constructs a field with the given key and an arbitrary object. It uses an encoding-appropriate, reflection-based function to lazily serialize nearly any object into the logging context, but it's relatively slow and allocation-heavy. Outside tests, Any is always a better choice. If encoding
(key string, val interface{})
| 324 | // If encoding fails (e.g., trying to serialize a map[int]string to JSON), Reflect |
| 325 | // includes the error message in the final log output. |
| 326 | func Reflect(key string, val interface{}) Field { |
| 327 | return Field{Key: key, Type: zapcore.ReflectType, Interface: val} |
| 328 | } |
| 329 | |
| 330 | // Namespace creates a named, isolated scope within the logger's context. All |
| 331 | // subsequent fields will be added to the new namespace. |
no outgoing calls