Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish server and client debug logs #144

Closed
kayrus opened this issue Jul 12, 2021 · 3 comments
Closed

Distinguish server and client debug logs #144

kayrus opened this issue Jul 12, 2021 · 3 comments
Labels

Comments

@kayrus
Copy link
Contributor

kayrus commented Jul 12, 2021

Currently the debug mode writes all the input and output into one stream:

go-smtp/conn.go

Lines 84 to 85 in 26eb481

io.TeeReader(rwc.Reader, c.server.Debug),
io.MultiWriter(rwc.Writer, c.server.Debug),

I'd like to have independent debug streams and alternatively skip or mask AUTH command details.

Probably it's also worth adding an error handler inside the WriteResponse method, e.g. ResponseLog but not in server, but connection scope to have an ability to specify the requestID/connectionID.

@kayrus
Copy link
Contributor Author

kayrus commented Jul 12, 2021

@emersion something like this for sessions logging: https://gist.github.com/kayrus/860c1e9d522e382fcf0b6b8f420017b9

@kayrus
Copy link
Contributor Author

kayrus commented Jul 12, 2021

Another use case is to catch stale connection events, when AUTH was done but the rest wasn't, and a connection was timed out.

@emersion
Copy link
Owner

Sorry, but I'll close this as out-of-scope. The DebugWriter functionality was never meant to be a way for library users to add more functionality, it's purely a debugging tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants