From a484376287186bec81b13fb10b235d3de8ac093e Mon Sep 17 00:00:00 2001 From: Prince Kumar Date: Tue, 25 Jun 2024 15:07:47 +0000 Subject: [PATCH] Improving fuse response log for better debuggability --- connection.go | 2 +- debug.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/connection.go b/connection.go index dfbb856..d9e6c04 100644 --- a/connection.go +++ b/connection.go @@ -510,7 +510,7 @@ func (c *Connection) Reply(ctx context.Context, opErr error) error { // Debug logging if c.debugLogger != nil { if opErr == nil { - c.debugLog(fuseID, 1, "-> OK (%s)", describeResponse(op)) + c.debugLog(fuseID, 1, "-> %s", describeResponse(op)) } else { c.debugLog(fuseID, 1, "-> Error: %q", opErr.Error()) } diff --git a/debug.go b/debug.go index def7b4d..f486a84 100644 --- a/debug.go +++ b/debug.go @@ -144,11 +144,10 @@ func describeResponse(op interface{}) string { addComponent("inode %v", entry.Child) } } - switch typed := op.(type) { case *fuseops.OpenFileOp: addComponent("handle %d", typed.Handle) } - return fmt.Sprintf("%s", strings.Join(components, ", ")) + return fmt.Sprintf("%s (%s)", opName(op), strings.Join(components, ", ")) }