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