func sensitive(c *imap.Client, action string) imap.LogMask { mask := c.SetLogMask(imap.LogConn) hide := imap.LogCmd | imap.LogRaw if mask&hide != 0 { c.Logln(imap.LogConn, "Raw logging disabled during", action) } c.SetLogMask(mask &^ hide) return mask }
func login(c *imap.Client, user, pass string) (cmd *imap.Command, err error) { defer c.SetLogMask(sensitive(c, "LOGIN")) return c.Login(user, pass) }