fix(chrome): record console levels on the logcat scale

Claude-Session: https://claude.ai/code/session_01ShuAy8q8ZfPi8KHxwc8JpQ
This commit is contained in:
pj committed 2026-08-16 01:23:45 +05:30
1 parent 9b1fbdf60f
commit beb036d2c1
2 files changed
+45 -6

No files matched your search

+28 -1
View File
@@ -1,6 +1,33 @@
package chrome
import "testing"
import (
"testing"
"github.com/chromedp/cdproto/runtime"
)
// Every console verb has to land on the logcat scale driver.LogEntry declares:
// the runner fetches at "E" and the default properties count entries whose
// level equals "E", so a level spelled any other way is an error the spec never
// sees. A verb with no mapping is info, which is honest about severity without
// fabricating an error the page never logged.
func TestConsoleLevel(t *testing.T) {
cases := map[runtime.APIType]string{
runtime.APITypeError: "E",
runtime.APITypeAssert: "E",
runtime.APITypeWarning: "W",
runtime.APITypeDebug: "D",
runtime.APITypeLog: "I",
runtime.APITypeInfo: "I",
runtime.APITypeTable: "I",
runtime.APIType("countReset"): "I",
}
for apiType, want := range cases {
if got := consoleLevel(apiType); got != want {
t.Errorf("consoleLevel(%q) = %q, want %q", apiType, got, want)
}
}
}
// A level the scale does not name is unknown, not verbose. Ranking it below
// every threshold is what silently emptied the web log channel: the entries