mirror of
https://github.com/MedzikUser/go-github-selfupdate.git
synced 2024-08-15 03:25:29 +00:00
29 lines
457 B
Go
29 lines
457 B
Go
|
package selfupdate
|
||
|
|
||
|
import (
|
||
|
"io/ioutil"
|
||
|
stdlog "log"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
var log = stdlog.New(os.Stderr, "", stdlog.Ltime)
|
||
|
var logEnabled = true
|
||
|
|
||
|
// EnableLog enables to output logging messages in library
|
||
|
func EnableLog() {
|
||
|
if logEnabled {
|
||
|
return
|
||
|
}
|
||
|
logEnabled = true
|
||
|
log.SetOutput(os.Stderr)
|
||
|
}
|
||
|
|
||
|
// DisableLog disables to output logging messages in library
|
||
|
func DisableLog() {
|
||
|
if !logEnabled {
|
||
|
return
|
||
|
}
|
||
|
logEnabled = false
|
||
|
log.SetOutput(ioutil.Discard)
|
||
|
}
|