2017-04-01 04:19:50 +00:00
|
|
|
package server
|
2017-02-25 05:56:40 +00:00
|
|
|
|
|
|
|
import (
|
2017-03-27 21:09:25 +00:00
|
|
|
"io"
|
2017-02-25 05:56:40 +00:00
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2017-03-27 21:09:25 +00:00
|
|
|
//Logoutput -- passing the output writer from main
|
2017-03-13 21:46:11 +00:00
|
|
|
loginfo *log.Logger
|
|
|
|
logdebug *log.Logger
|
|
|
|
logFlags = log.Ldate | log.Lmicroseconds | log.Lshortfile
|
|
|
|
connectionID int64
|
2017-02-25 05:56:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2017-04-01 04:19:50 +00:00
|
|
|
loginfo = log.New(os.Stdout, "INFO: server: ", logFlags)
|
|
|
|
logdebug = log.New(os.Stdout, "DEBUG: server:", logFlags)
|
2017-03-13 21:46:11 +00:00
|
|
|
connectionID = 0
|
2017-02-25 05:56:40 +00:00
|
|
|
}
|
2017-03-27 21:09:25 +00:00
|
|
|
|
|
|
|
//InitLogging -- after main sets up output, it will init all packages InitLogging
|
|
|
|
//I am sure I am doing this wrong, but I could not find a way to have package level
|
|
|
|
//logging with the flags I wanted and the ability to run lumberjack file management
|
|
|
|
func InitLogging(logoutput io.Writer) {
|
|
|
|
loginfo.SetOutput(logoutput)
|
|
|
|
|
|
|
|
}
|