0.2.63 update

This commit is contained in:
ponzischeme89
2026-08-14 11:47:32 +12:00
parent 9a8ecbdceb
commit 06b6490ac9
41 changed files with 921 additions and 179 deletions
+13 -11
View File
@@ -59,7 +59,7 @@ func (h *consoleHandler) Handle(_ context.Context, record slog.Record) error {
var line strings.Builder
line.WriteString(record.Time.UTC().Format(time.DateTime))
line.WriteByte(' ')
line.WriteString(pad(record.Level.String(), levelWidth))
line.WriteString(pad(LevelName(record.Level), levelWidth))
line.WriteByte(' ')
line.WriteString(pad(record.Message, messageWidth))
for _, f := range fields {
@@ -103,7 +103,7 @@ func appendField(target []field, groups []string, attr slog.Attr) []field {
return target
}
key := strings.Join(append(append([]string{}, groups...), attr.Key), ".")
return append(target, field{key: key, value: attributeValue(attr.Value)})
return append(target, field{key: key, value: safeAttribute(key, attributeValue(attr.Value))})
}
// fieldRank puts the fields that identify *who and where* first, in the same order on
@@ -111,15 +111,17 @@ func appendField(target []field, groups []string, attr slog.Attr) []field {
// Anything unranked keeps the order the caller wrote it in, which is usually the order
// that reads best for that particular event.
var fieldRank = map[string]int{
"component": 1,
"user": 2,
"device": 3,
"client": 4,
"protocol": 5,
"method": 6,
"path": 7,
"status": 8,
"duration": 9,
"component": 1,
"user": 2,
"device": 3,
"client": 4,
"correlation": 5,
"play_session_id": 6,
"protocol": 7,
"method": 8,
"path": 9,
"status": 10,
"duration": 11,
// Constant per process, so it belongs at the end of the line rather than in front
// of the fields that differ between events.
"version": 900,