...

Source file src/github.com/go-ldap/ldap/v3/debug.go

Documentation: github.com/go-ldap/ldap/v3

     1  package ldap
     2  
     3  import (
     4  	ber "github.com/go-asn1-ber/asn1-ber"
     5  )
     6  
     7  // debugging type
     8  //   - has a Printf method to write the debug output
     9  type debugging bool
    10  
    11  // Enable controls debugging mode.
    12  func (debug *debugging) Enable(b bool) {
    13  	*debug = debugging(b)
    14  }
    15  
    16  // Printf writes debug output.
    17  func (debug debugging) Printf(format string, args ...interface{}) {
    18  	if debug {
    19  		logger.Printf(format, args...)
    20  	}
    21  }
    22  
    23  // PrintPacket dumps a packet.
    24  func (debug debugging) PrintPacket(packet *ber.Packet) {
    25  	if debug {
    26  		ber.WritePacket(logger.Writer(), packet)
    27  	}
    28  }
    29  

View as plain text