Skip to content

[log] debug: add intermediate logging to GenerateSelfSignedTLS in proxy/tls.go#3154

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
log/proxy-tls-debug-logging-d9fffd19d0582a25
Draft

[log] debug: add intermediate logging to GenerateSelfSignedTLS in proxy/tls.go#3154
github-actions[bot] wants to merge 1 commit intomainfrom
log/proxy-tls-debug-logging-d9fffd19d0582a25

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 4, 2026

Summary

Adds 3 debug log calls to GenerateSelfSignedTLS in internal/proxy/tls.go using the existing logTLS logger (logger.New("proxy:tls")).

Changes

The function already logged at entry and completion. This PR adds intermediate checkpoints:

Step New Log Call
CA cert created logTLS.Printf("CA certificate created: serial=%s, notBefore=%s, notAfter=%s", ...)
Server cert created logTLS.Printf("server certificate created: dnsNames=%v, ipAddresses=%v", ...)
PEM files written logTLS.Printf("TLS certificate files written: caCert=%s, cert=%s, key=%s", ...)
Key pair loaded logTLS.Print("TLS key pair loaded successfully")

Why This Helps

GenerateSelfSignedTLS performs several distinct operations (key generation, cert signing, file I/O, key-pair loading) where any step can fail independently. Without intermediate logging, a failure at "failed to load server cert pair" gives no indication whether the issue is in the key generation, cert creation, or file writing phases. The new logs pinpoint exactly how far the function progressed before failing.

Logging Guidelines Followed

  • Reuses existing logTLS logger — no duplicate declaration
  • Printf used for structured data (serial, SANs, file paths)
  • Print used for simple state confirmations
  • No side effects in logger arguments
  • All values are already computed before the log call
  • 6 total log calls (3 existing + 3 new) — within the 3–7 recommended range

Files Changed

  • internal/proxy/tls.go — 5 lines added (3 log calls + 1 newline separation)

Generated by Go Logger Enhancement ·

Add 3 debug log calls to the GenerateSelfSignedTLS function in
internal/proxy/tls.go to improve observability during TLS certificate
generation:

- Log CA certificate creation with serial number and validity period
- Log server certificate creation with DNS names and IP addresses
- Log certificate file paths after writing all three PEM files
- Log successful TLS key pair loading

These intermediate checkpoints complement the existing entry/exit logs,
making it easier to pinpoint where certificate generation fails during
troubleshooting (e.g. key generation vs cert signing vs file I/O vs
key-pair loading).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants