Skip to content

fix: replace debug fmt.Println with hlog in printNode - #1532

Open
lxcxjxhx wants to merge 1 commit into
cloudwego:mainfrom
lxcxjxhx:fix/1525-replace-fmt-with-hlog
Open

fix: replace debug fmt.Println with hlog in printNode#1532
lxcxjxhx wants to merge 1 commit into
cloudwego:mainfrom
lxcxjxhx:fix/1525-replace-fmt-with-hlog

Conversation

@lxcxjxhx

Copy link
Copy Markdown

Description

Replace debug fmt.Println/fmt.Printf calls in printNode() with hlog.SystemLogger().Debugf() to use the proper logging framework.

Problem

printNode() in engine.go uses fmt.Println and fmt.Printf for debug output, which writes directly to stdout instead of using Hertz's logging framework (hlog).

This causes:

  • Debug output bypasses the logging system configuration
  • Cannot control log level or output destination for these messages
  • Inconsistent with the rest of the codebase which uses hlog.SystemLogger()

Fix

Replace fmt.Println/fmt.Printf calls with hlog.SystemLogger().Debugf().

Changes

  • pkg/route/engine.go: Replace 3 fmt.Print* calls in printNode() with hlog.SystemLogger().Debugf()

Testing

  • go build ./pkg/route/... pass
  • go test ./pkg/route/... pass (1.7s)

Related

printNode() used fmt.Println/Printf for debug output, which bypasses
the logging framework. Replace with hlog.SystemLogger().Debugf() for
consistent logging behavior.

Fixes cloudwego#1525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

fix: replace debug fmt.Println with hlog in printNode

1 participant