SYNOPSYS

     import "clive/dbg"

     var ExitDumpsStacks  bool  func  Exit(args  ...interface{})  func
     Fatal(args ...interface{}) func HexStr(data []byte, n int) string
     func Printf(str string, args ...interface{}) (n int,  err  error)
     func  Str(s  string,  n  int)  string  func Warn(str string, args
     ...interface{}) (n int, err error)  func  FlagPrintf(flag  *bool)
     PrintFunc  type  Flag  struct  {  ...  } type PrintFunc func(fmts
     string, arg ...interface{}) (int, error)
         func FlagPrintf(flag *bool) PrintFunc

     DESCRIPTION

     Debug tools

     CONSTANTS

     TYPES

     type Flag struct {         Tag   string // prefixing debug prints
             Debug bool   // enable debug prints }
         To be embedded in structures to add a debug flag and  Dprintf
     function.

     func (d Flag) Dprintf(str string, args  ...interface{})  (n  int,
     err error)
         Printf with d.Tag if d.Debug is set

     type PrintFunc func(fmts string, arg ...interface{}) (int, error)
         Print functions generated by FlagPrintf.

     func FlagPrintf(flag *bool) PrintFunc
         Return a function that calls Printf but  only  when  flag  is
     set.

     FUNCTIONS

     func Exit(args ...interface{})
         Exit with 0 or 1 depending on the args (like Fatal),  but  do
     not print.

     func Fatal(args ...interface{})
         Warn and exit

     func HexStr(data []byte, n int) string
         Return a string with the hex dump of at  most  n  bytes  from
     data (all if n is
         0) for debugging.

     func Printf(str string, args ...interface{}) (n int, err error)
         Atomic print to stderr

     func Str(s string, n int) string
         Return a string with at most n runes for debugging

     func Warn(str string, args ...interface{}) (n int, err error)
         Printf to stderr, prefixed with program name and  terminating
     with \n. Each
         warn is atomic.

     VARIABLES

     var (         ExitDumpsStacks bool // If set Fatal/Exit will dump
     the stacks

     )

     User's manual, 2nd ed. Section 2 Copyright © LSUB 2014-2016