2024-01-15 15:54:53 -06:00
|
|
|
// Copyright 2024 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.
|
|
|
|
|
2023-12-30 20:48:24 -06:00
|
|
|
package log
|
|
|
|
|
2024-11-07 01:23:43 -06:00
|
|
|
import (
|
2024-01-14 12:27:10 -06:00
|
|
|
"go.wit.com/dev/davecgh/spew"
|
2023-12-30 20:48:24 -06:00
|
|
|
)
|
|
|
|
|
2023-12-31 19:44:55 -06:00
|
|
|
func Spew(b any, a ...any) {
|
2024-11-07 01:23:43 -06:00
|
|
|
if !SPEW.Ok() {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if !SPEW.b {
|
|
|
|
return
|
|
|
|
}
|
2023-12-30 20:48:24 -06:00
|
|
|
|
2023-12-31 19:44:55 -06:00
|
|
|
switch b.(type) {
|
|
|
|
case bool:
|
2024-11-07 01:23:43 -06:00
|
|
|
if !b.(bool) {
|
2023-12-31 19:44:55 -06:00
|
|
|
return
|
|
|
|
}
|
2024-10-12 16:21:47 -05:00
|
|
|
realPrintln("SPEW:", spew.Sdump(a...))
|
2024-01-01 01:49:53 -06:00
|
|
|
case LogFlag:
|
|
|
|
var f LogFlag
|
|
|
|
f = b.(LogFlag)
|
2024-11-07 01:23:43 -06:00
|
|
|
if !f.b {
|
2023-12-31 19:44:55 -06:00
|
|
|
return
|
|
|
|
}
|
2024-10-12 16:21:47 -05:00
|
|
|
realPrintln("SPEW:", spew.Sdump(a...))
|
2023-12-31 19:44:55 -06:00
|
|
|
default:
|
2024-10-12 16:21:47 -05:00
|
|
|
realPrintln("SPEW b:", spew.Sdump(b))
|
|
|
|
realPrintln("SPEW a:", spew.Sdump(a...))
|
2023-12-31 19:44:55 -06:00
|
|
|
}
|
2024-10-12 16:21:47 -05:00
|
|
|
// realPrintln("SPEW:", spew.Sdump(a...))
|
2023-12-30 20:48:24 -06:00
|
|
|
/*
|
2024-11-07 01:23:43 -06:00
|
|
|
scs := spew.ConfigState{Indent: "\t", MaxDepth: 1}
|
|
|
|
// Output using the ConfigState instance.
|
|
|
|
v := map[string]int{"one": 1}
|
|
|
|
scs.Printf("v: %v\n", v)
|
|
|
|
scs.Dump(v)
|
|
|
|
scs.Dump(a)
|
2023-12-30 20:48:24 -06:00
|
|
|
*/
|
|
|
|
}
|