Skip to content

Commit b57d94f

Browse files
author
vals
committed
Update
1 parent 7fa8b35 commit b57d94f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func objectMessage(
173173
a ...any,
174174
) string {
175175
// Output object.
176-
// A general structure for outputting a logo in JSON format.
176+
// A general structure for outputting a log in JSON format.
177177
obj := struct {
178178
Prefix string `json:"prefix,omitempty"`
179179
Level string `json:"level,omitempty"`
@@ -210,7 +210,7 @@ func objectMessage(
210210

211211
// Function address.
212212
if o.Layouts.FuncAddress() {
213-
obj.FuncName = fmt.Sprintf("%#x", sf.FuncAddress)
213+
obj.FuncAddress = fmt.Sprintf("%#x", sf.FuncAddress)
214214
}
215215

216216
// Line number.
@@ -237,16 +237,20 @@ func objectMessage(
237237

238238
// Add JSON formatting.
239239
var msg string
240-
241240
switch {
242241
case f == "":
243242
fallthrough
244243
case f == formatPrint:
245-
msg = fmt.Sprintf("%s%s", data, o.Space)
244+
msg = string(data)
246245
default: // for formatStrLn and others
247246
msg = fmt.Sprintf("%s\n", data)
248247
}
249248

249+
// Add space if necessary.
250+
if o.Space != "" {
251+
msg += o.Space
252+
}
253+
250254
return msg
251255
}
252256

0 commit comments

Comments
 (0)