debug.go 327 B

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