X7ROOT File Manager
Current Path:
/opt/golang/1.22.0/src/log/slog
opt
/
golang
/
1.22.0
/
src
/
log
/
slog
/
📁
..
📄
attr.go
(2.49 KB)
📄
attr_test.go
(891 B)
📄
doc.go
(12.13 KB)
📄
example_custom_levels_test.go
(2.99 KB)
📄
example_level_handler_test.go
(2.18 KB)
📄
example_log_level_test.go
(1.85 KB)
📄
example_logvaluer_group_test.go
(825 B)
📄
example_logvaluer_secret_test.go
(906 B)
📄
example_test.go
(857 B)
📄
example_wrap_test.go
(1.34 KB)
📄
handler.go
(17.48 KB)
📄
handler_test.go
(19.61 KB)
📁
internal
📄
json_handler.go
(8.05 KB)
📄
json_handler_test.go
(6.48 KB)
📄
level.go
(5.64 KB)
📄
level_test.go
(3.75 KB)
📄
logger.go
(10.22 KB)
📄
logger_test.go
(19.48 KB)
📄
record.go
(5.98 KB)
📄
record_test.go
(4 KB)
📄
slogtest_test.go
(2.61 KB)
📄
text_handler.go
(4.71 KB)
📄
text_handler_test.go
(3.81 KB)
📄
value.go
(12.8 KB)
📄
value_access_benchmark_test.go
(4.29 KB)
📄
value_test.go
(6.08 KB)
Editing: example_logvaluer_group_test.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package slog_test import "log/slog" type Name struct { First, Last string } // LogValue implements slog.LogValuer. // It returns a group containing the fields of // 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": { // "first": "Perry", // "last": "Platypus" // } // } }
Upload File
Create Folder