Adding upstream version 1.2.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3a3aa427d7
commit
e7ed09875d
58 changed files with 3068 additions and 0 deletions
30
selfupdate/log.go
Normal file
30
selfupdate/log.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package selfupdate
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
stdlog "log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var log = stdlog.New(ioutil.Discard, "", 0)
|
||||
var logEnabled = false
|
||||
|
||||
// EnableLog enables to output logging messages in library
|
||||
func EnableLog() {
|
||||
if logEnabled {
|
||||
return
|
||||
}
|
||||
logEnabled = true
|
||||
log.SetOutput(os.Stderr)
|
||||
log.SetFlags(stdlog.Ltime)
|
||||
}
|
||||
|
||||
// DisableLog disables to output logging messages in library
|
||||
func DisableLog() {
|
||||
if !logEnabled {
|
||||
return
|
||||
}
|
||||
logEnabled = false
|
||||
log.SetOutput(ioutil.Discard)
|
||||
log.SetFlags(0)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue