From 5553aeaec44a50143f62cf9a1e787dc12a522aa9384a4b692e7e55be5254f555 Mon Sep 17 00:00:00 2001 From: Lixen Wraith Date: Fri, 17 Jul 2026 13:51:28 -0400 Subject: [PATCH] v0.1.7 removed spew usage for serializing complex raw logs --- go.mod | 6 ++---- sanitizer/sanitizer.go | 24 ++---------------------- sanitizer/sanitizer_test.go | 1 - 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/go.mod b/go.mod index 378f743..ce2d90a 100644 --- a/go.mod +++ b/go.mod @@ -2,12 +2,10 @@ module github.com/lixenwraith/log go 1.26.0 -require ( - github.com/davecgh/go-spew v1.1.1 - github.com/stretchr/testify v1.11.1 -) +require github.com/stretchr/testify v1.11.1 require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sanitizer/sanitizer.go b/sanitizer/sanitizer.go index 7314bc0..4dcfbdf 100644 --- a/sanitizer/sanitizer.go +++ b/sanitizer/sanitizer.go @@ -8,14 +8,11 @@ package sanitizer import ( - "bytes" "encoding/hex" "fmt" "strconv" "unicode" "unicode/utf8" - - "github.com/davecgh/go-spew/spew" ) // Filter flags for character matching @@ -323,24 +320,8 @@ func (se *Serializer) WriteNil(buf *[]byte) { // WriteComplex writes complex types func (se *Serializer) WriteComplex(buf *[]byte, v any) { - switch se.format { - // For debugging - case "raw": - var b bytes.Buffer - dumper := &spew.ConfigState{ - Indent: " ", - MaxDepth: 10, - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, - } - dumper.Fdump(&b, v) - *buf = append(*buf, bytes.TrimSpace(b.Bytes())...) - - default: - str := fmt.Sprintf("%+v", v) - se.WriteString(buf, str) - } + str := fmt.Sprintf("%+v", v) + se.WriteString(buf, str) } // NeedsQuotes determines if quoting is needed @@ -371,4 +352,3 @@ func (se *Serializer) NeedsQuotes(s string) bool { return false } } - diff --git a/sanitizer/sanitizer_test.go b/sanitizer/sanitizer_test.go index bd0d146..067a9fa 100644 --- a/sanitizer/sanitizer_test.go +++ b/sanitizer/sanitizer_test.go @@ -300,4 +300,3 @@ func TestPolicyShellExtended(t *testing.T) { assert.Equal(t, "rm-rf", s.Sanitize("rm -rf *")) assert.Equal(t, "ab", s.Sanitize("a\x00\x1bb")) // control stripped } -