logtree: implement raw logging
Test Plan: Covered by new tests.
X-Origin-Diff: phab/D640
GitOrigin-RevId: 786ab2851710bf2819dcb91571b3567e8da3e377
diff --git a/core/pkg/logtree/logtree.go b/core/pkg/logtree/logtree.go
index 4d674fd..064b6e7 100644
--- a/core/pkg/logtree/logtree.go
+++ b/core/pkg/logtree/logtree.go
@@ -20,9 +20,11 @@
"fmt"
"strings"
"sync"
+
+ "git.monogon.dev/source/nexantic.git/core/pkg/logbuffer"
)
-// LogTree is a tree-shapped logging system. For more information, see the package-level documentation.
+// LogTree is a tree-shaped logging system. For more information, see the package-level documentation.
type LogTree struct {
// journal is the tree's journal, storing all log data and managing subscribers.
journal *journal
@@ -39,7 +41,7 @@
return lt
}
-// node represents a given DN as a discrete 'logger'. It implementes the LeveledLogger interface for log publishing,
+// node represents a given DN as a discrete 'logger'. It implements the LeveledLogger interface for log publishing,
// entries from which it passes over to the logtree's journal.
type node struct {
// dn is the DN which this node represents (or "" if this is the root node).
@@ -47,7 +49,8 @@
// tree is the LogTree to which this node belongs.
tree *LogTree
// verbosity is the current verbosity level of this DN/node, affecting .V(n) LeveledLogger calls
- verbosity VerbosityLevel
+ verbosity VerbosityLevel
+ rawLineBuffer *logbuffer.LineBuffer
// mu guards children.
mu sync.Mutex
@@ -63,6 +66,7 @@
tree: tree,
children: make(map[string]*node),
}
+ n.rawLineBuffer = logbuffer.NewLineBuffer(1024, n.logRaw)
return n
}