Remove logging
This commit is contained in:
parent
d417fa653f
commit
f14ed3a85e
29
logging.go
29
logging.go
|
@ -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())
|
|
||||||
}
|
|
8
main.go
8
main.go
|
@ -2,8 +2,10 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/KosyanMedia/burlesque/hub"
|
"github.com/KosyanMedia/burlesque/hub"
|
||||||
|
@ -43,6 +45,10 @@ func main() {
|
||||||
os.Exit(0)
|
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()
|
startServer()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ func startServer() {
|
||||||
http.HandleFunc("/subscribe", subHandler)
|
http.HandleFunc("/subscribe", subHandler)
|
||||||
|
|
||||||
if err := http.ListenAndServe(fmt.Sprintf(":%d", config.port), nil); err != nil {
|
if err := http.ListenAndServe(fmt.Sprintf(":%d", config.port), nil); err != nil {
|
||||||
alert(err, "Error starting server on port %d", config.port)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue