github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/log/slog/example_logvaluer_group_test.go (about)

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package slog_test
     6  
     7  import "github.com/shogo82148/std/log/slog"
     8  
     9  func ExampleLogValuer_group() {
    10  	n := Name{"Perry", "Platypus"}
    11  	slog.Info("mission accomplished", "agent", n)
    12  
    13  	// JSON Output would look in part like:
    14  	// {
    15  	//     ...
    16  	//     "msg": "mission accomplished",
    17  	//     "agent": {
    18  	//         "first": "Perry",
    19  	//         "last": "Platypus"
    20  	//     }
    21  	// }
    22  }