debug.go 351 B

1234567891011121314151617181920212223
  1. // +build lz4debug
  2. package lz4
  3. import (
  4. "fmt"
  5. "os"
  6. "path/filepath"
  7. "runtime"
  8. )
  9. const debugFlag = true
  10. func debug(args ...interface{}) {
  11. _, file, line, _ := runtime.Caller(1)
  12. file = filepath.Base(file)
  13. f := fmt.Sprintf("LZ4: %s:%d %s", file, line, args[0])
  14. if f[len(f)-1] != '\n' {
  15. f += "\n"
  16. }
  17. fmt.Fprintf(os.Stderr, f, args[1:]...)
  18. }