File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 66 "encoding/binary"
77 "io"
88 "log/slog"
9+ "os"
10+ "path"
911 "runtime"
1012 "slices"
1113 "strconv"
@@ -99,6 +101,8 @@ func (h *Handler) Enabled(_ context.Context, level slog.Level) bool {
99101 return level >= h .opts .Level .Level ()
100102}
101103
104+ var identifier = []byte (path .Base (os .Args [0 ]))
105+
102106// Handle handles the Record.
103107// It will only be called when Enabled returns true.
104108// The Context argument is as for Enabled.
@@ -137,6 +141,8 @@ func (h *Handler) Handle(ctx context.Context, r slog.Record) error {
137141 buf = h .appendKV (buf , "SYSLOG_TIMESTAMP" , []byte (timestampStr ))
138142 }
139143
144+ buf = h .appendKV (buf , "SYSLOG_IDENTIFIER" , identifier )
145+
140146 buf = append (buf , h .preformatted ... )
141147
142148 r .Attrs (func (a slog.Attr ) bool {
You can’t perform that action at this time.
0 commit comments