initial commit
This commit is contained in:
commit
3f79fc8e6c
527 changed files with 373170 additions and 0 deletions
21
logger.go
Normal file
21
logger.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
logger "log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var log *logger.Logger
|
||||
|
||||
func newLogger(file string) {
|
||||
if file == "" {
|
||||
log = logger.New(os.Stdout, "", logger.LstdFlags)
|
||||
return
|
||||
}
|
||||
f, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
|
||||
if err != nil {
|
||||
logger.Fatal(err)
|
||||
}
|
||||
logger.SetOutput(f)
|
||||
log = logger.New(f, "", logger.LstdFlags)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue