types/logger: add AsJSON

Printing out JSON representation things in log output is pretty common.

Updates #cleanup

Change-Id: Ife2d2e321a18e6e1185efa8b699a23061ac5e5a4
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-08-28 15:01:38 -07:00
committed by Brad Fitzpatrick
parent a79b1d23b8
commit 590c693b96
6 changed files with 61 additions and 21 deletions

View File

@@ -4,7 +4,6 @@
package ipnlocal
import (
"encoding/json"
"fmt"
"os/user"
"strconv"
@@ -312,10 +311,6 @@ func TestProfileDupe(t *testing.T) {
}
}
func asJSON(v any) []byte {
return must.Get(json.MarshalIndent(v, "", " "))
}
// TestProfileManagement tests creating, loading, and switching profiles.
func TestProfileManagement(t *testing.T) {
store := new(mem.Store)