log/spew.go

46 lines
853 B
Go
Raw Permalink Normal View History

// 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
import (
"go.wit.com/dev/davecgh/spew"
2023-12-30 20:48:24 -06:00
)
func Spew(b any, a ...any) {
if !SPEW.Ok() {
return
}
if !SPEW.b {
return
}
2023-12-30 20:48:24 -06:00
switch b.(type) {
case bool:
if !b.(bool) {
return
}
realPrintln("SPEW:", spew.Sdump(a...))
case LogFlag:
var f LogFlag
f = b.(LogFlag)
if !f.b {
return
}
realPrintln("SPEW:", spew.Sdump(a...))
default:
realPrintln("SPEW b:", spew.Sdump(b))
realPrintln("SPEW a:", spew.Sdump(a...))
}
// realPrintln("SPEW:", spew.Sdump(a...))
2023-12-30 20:48:24 -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
*/
}