Skip to content

Commit c025599

Browse files
committed
refactor: print the rest if not dictionary
1 parent 29fd7a1 commit c025599

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

object.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,30 @@ func PrintData(value any, decode, printHex bool,
6868
connName := fmt.Sprintf("Connection Name: %s\n", data["connName"])
6969
if _, ok := data["dictionary"]; ok {
7070
printData(reflect.ValueOf(data["dictionary"]), "", "", &message)
71-
total := len(fnName) + len(connName) + len(message) + 100
72-
73-
builder := strings.Builder{}
74-
builder.Grow(total)
75-
76-
builder.WriteString(fnName)
77-
builder.WriteString(connName)
78-
builder.WriteString("Data:\n")
79-
builder.WriteString(message)
80-
builder.WriteString(fmt.Sprintf("\n%s\n", strings.Repeat("=", 80)))
81-
82-
logger.Scriptf("%d) Name: %s", msg, data["name"])
83-
logger.Scriptf("Connection Name: %s", data["connName"])
84-
pid, ok := data["pid"].(float64)
85-
if ok {
86-
logger.Scriptf("PID: %d", int(pid))
87-
}
88-
logger.Scriptf("Data:")
89-
logger.Scriptf("%s", message)
90-
fmt.Println(strings.Repeat("=", 80))
91-
92-
logger.writeToFileScript(builder.String())
9371
}
72+
total := len(fnName) + len(connName) + len(message) + 100
73+
74+
builder := strings.Builder{}
75+
builder.Grow(total)
76+
77+
builder.WriteString(fnName)
78+
builder.WriteString(connName)
79+
builder.WriteString("Data:\n")
80+
builder.WriteString(message)
81+
builder.WriteString(fmt.Sprintf("\n%s\n", strings.Repeat("=", 80)))
82+
83+
logger.Scriptf("%d) Name: %s", msg, data["name"])
84+
logger.Scriptf("Connection Name: %s", data["connName"])
85+
pid, ok := data["pid"].(float64)
86+
if ok {
87+
logger.Scriptf("PID: %d", int(pid))
88+
}
89+
logger.Scriptf("Data:")
90+
logger.Scriptf("%s", message)
91+
fmt.Println(strings.Repeat("=", 80))
92+
93+
logger.writeToFileScript(builder.String())
94+
9495
}
9596

9697
func printData(v reflect.Value, key, indent string, message *string) {

0 commit comments

Comments
 (0)