]>
Commit | Line | Data |
---|---|---|
15c0b25d AP |
1 | package complete |
2 | ||
3 | import ( | |
15c0b25d AP |
4 | "io/ioutil" |
5 | "log" | |
6 | "os" | |
7 | ) | |
8 | ||
9 | // Log is used for debugging purposes | |
10 | // since complete is running on tab completion, it is nice to | |
11 | // have logs to the stderr (when writing your own completer) | |
12 | // to write logs, set the COMP_DEBUG environment variable and | |
13 | // use complete.Log in the complete program | |
14 | var Log = getLogger() | |
15 | ||
16 | func getLogger() func(format string, args ...interface{}) { | |
107c1cdb | 17 | var logfile = ioutil.Discard |
15c0b25d AP |
18 | if os.Getenv(envDebug) != "" { |
19 | logfile = os.Stderr | |
20 | } | |
21 | return log.New(logfile, "complete ", log.Flags()).Printf | |
22 | } |