]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/posener/complete/log.go
Merge branch 'fix_read_test' of github.com:alexandreFre/terraform-provider-statuscake
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / posener / complete / log.go
CommitLineData
15c0b25d
AP
1package complete
2
3import (
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
14var Log = getLogger()
15
16func 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}