mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
Refactor SMTP handler_test log collection (#289)
* smtp: allow logger to be passed into startSession * smtp: remove logbuf and teardown from handler_test * smtp: handler_test log output to testing.T
This commit is contained in:
@@ -15,7 +15,6 @@ import (
|
||||
|
||||
"github.com/inbucket/inbucket/pkg/policy"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// State tracks the current mode of our SMTP state machine.
|
||||
@@ -144,8 +143,8 @@ func (s *Session) String() string {
|
||||
* 4. If bad cmd, respond error
|
||||
* 5. Goto 2
|
||||
*/
|
||||
func (s *Server) startSession(id int, conn net.Conn) {
|
||||
logger := log.Hook(logHook{}).With().
|
||||
func (s *Server) startSession(id int, conn net.Conn, logger zerolog.Logger) {
|
||||
logger = logger.Hook(logHook{}).With().
|
||||
Str("module", "smtp").
|
||||
Str("remote", conn.RemoteAddr().String()).
|
||||
Int("session", id).Logger()
|
||||
|
||||
Reference in New Issue
Block a user