api log saved to disk and shown in console
parent
a3240b1da1
commit
989c56bee0
|
|
@ -3,4 +3,7 @@
|
|||
api
|
||||
api.exe
|
||||
|
||||
pcast.db
|
||||
pcast.db
|
||||
api-homolog.log
|
||||
.gitignore
|
||||
api.log
|
||||
|
|
|
|||
11
main.go
11
main.go
|
|
@ -4,6 +4,7 @@ import (
|
|||
"api/database"
|
||||
"api/globals"
|
||||
"api/routes"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
|
|
@ -13,8 +14,16 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
logFile, err := os.OpenFile("api.log", os.O_CREATE | os.O_APPEND | os.O_RDWR, 0666)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mw := io.MultiWriter(os.Stdout, logFile)
|
||||
log.SetOutput(mw)
|
||||
|
||||
log.Println("Starting API", globals.API_VERSION)
|
||||
log.Println("OS:", os.Getenv("OS"))
|
||||
log.Println("OS:", os.Getenv("OS"))
|
||||
|
||||
app := fiber.New(fiber.Config{
|
||||
StrictRouting: false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue