Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleLogValuer_group (0.32 sec)

  1. src/log/slog/example_logvaluer_group_test.go

    // the Name, so that they appear together in the log output.
    func (n Name) LogValue() slog.Value {
    	return slog.GroupValue(
    		slog.String("first", n.First),
    		slog.String("last", n.Last))
    }
    
    func ExampleLogValuer_group() {
    	n := Name{"Perry", "Platypus"}
    	slog.Info("mission accomplished", "agent", n)
    
    	// JSON Output would look in part like:
    	// {
    	//     ...
    	//     "msg": "mission accomplished",
    	//     "agent": {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 21 20:55:33 UTC 2023
    - 825 bytes
    - Viewed (0)
Back to top