Merge pull request #97 from frankbraun/debug

introduce DebugWriter
This commit is contained in:
mattn
2018-04-23 11:14:11 +09:00
committed by GitHub

View File

@@ -45,6 +45,9 @@ const (
// Default TLS configuration options
var DefaultConfig tls.Config
// DebugWriter is the writer used to write debugging output to.
var DebugWriter io.Writer = os.Stderr
// Cookie is a unique XMPP session identifier
type Cookie uint64
@@ -524,7 +527,7 @@ func (c *Client) startTLSIfRequired(f *streamFeatures, o *Options, domain string
// will be returned.
func (c *Client) startStream(o *Options, domain string) (*streamFeatures, error) {
if o.Debug {
c.p = xml.NewDecoder(tee{c.conn, os.Stderr})
c.p = xml.NewDecoder(tee{c.conn, DebugWriter})
} else {
c.p = xml.NewDecoder(c.conn)
}