1
0
Fork 0

Remove logging

This commit is contained in:
Gregory Eremin 2014-09-11 14:30:15 +04:00
parent d417fa653f
commit f14ed3a85e
3 changed files with 8 additions and 31 deletions

View File

@ -1,29 +0,0 @@
package main
import (
loglib "log"
"os"
"runtime"
)
var (
logger *loglib.Logger
)
func setupLogging() {
logger = loglib.New(os.Stdout, "", loglib.Ldate|loglib.Lmicroseconds)
log("Burlesque v%s started", version)
log("GOMAXPROCS is set to %d", runtime.GOMAXPROCS(-1))
log("Storage path: %s", config.storage)
log("Server is running at http://127.0.0.1:%d", config.port)
}
func log(format string, args ...interface{}) {
logger.Printf("[INFO] "+format, args...)
}
func alert(err error, format string, args ...interface{}) {
logger.Printf("[ERROR] "+format, args...)
logger.Printf(" %s", err.Error())
}

View File

@ -2,8 +2,10 @@ package main
import (
"flag"
"fmt"
"os"
"os/signal"
"runtime"
"syscall"
"github.com/KosyanMedia/burlesque/hub"
@ -43,6 +45,10 @@ func main() {
os.Exit(0)
}()
setupLogging()
fmt.Println("Burlesque v%s started", version)
fmt.Println("GOMAXPROCS is set to %d", runtime.GOMAXPROCS(-1))
fmt.Println("Storage path: %s", config.storage)
fmt.Println("Server is running at http://127.0.0.1:%d", config.port)
startServer()
}

View File

@ -16,7 +16,7 @@ func startServer() {
http.HandleFunc("/subscribe", subHandler)
if err := http.ListenAndServe(fmt.Sprintf(":%d", config.port), nil); err != nil {
alert(err, "Error starting server on port %d", config.port)
panic(err)
}
}