diff options
author | Simon Ser <contact@emersion.fr> | 2020-02-11 18:39:52 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-02-11 18:39:52 +0100 |
commit | 13f541469198e29f9a16f54aeecf7b55cea629c8 (patch) | |
tree | 37e2e0af377f63545725acca8cddd0acfc05bf66 /session.go | |
parent | e59ad57e32289ef62e17a8361b6d36b77e56a25d (diff) | |
download | alps-13f541469198e29f9a16f54aeecf7b55cea629c8.tar.gz alps-13f541469198e29f9a16f54aeecf7b55cea629c8.zip |
cmd/koushin: add -debug flag
Diffstat (limited to 'session.go')
-rw-r--r-- | session.go | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -6,6 +6,7 @@ import ( "errors" "fmt" "net/http" + "os" "sync" "time" @@ -142,17 +143,19 @@ type SessionManager struct { dialIMAP DialIMAPFunc dialSMTP DialSMTPFunc logger echo.Logger + debug bool locker sync.Mutex sessions map[string]*Session // protected by locker } -func newSessionManager(dialIMAP DialIMAPFunc, dialSMTP DialSMTPFunc, logger echo.Logger) *SessionManager { +func newSessionManager(dialIMAP DialIMAPFunc, dialSMTP DialSMTPFunc, logger echo.Logger, debug bool) *SessionManager { return &SessionManager{ sessions: make(map[string]*Session), dialIMAP: dialIMAP, dialSMTP: dialSMTP, logger: logger, + debug: debug, } } @@ -167,6 +170,10 @@ func (sm *SessionManager) connectIMAP(username, password string) (*imapclient.Cl return nil, AuthError{err} } + if sm.debug { + c.SetDebug(os.Stderr) + } + return c, nil } |