Switch logger

Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
Odyssey
2023-01-07 17:54:04 +01:00
parent 93353c7551
commit 41ecec808c
4 changed files with 15 additions and 17 deletions

10
main.go
View File

@@ -6,7 +6,8 @@ import (
"github.com/ProjectSegfault/publapi/pages"
"github.com/gofiber/fiber/v2"
"go.uber.org/zap"
log "github.com/sirupsen/logrus"
)
// publapi is a simple API for Project Segfault's public shared server (pubnix).
@@ -21,15 +22,10 @@ func main() {
})
app.Get("/online", func(c *fiber.Ctx) error {
// set up logger
logger, _ := zap.NewProduction()
defer logger.Sync()
// Get the number of users online
out, err := exec.Command("users | wc -l").Output()
if err != nil {
logger.Error("failed to get number of users online", zap.Error(err))
log.Error(err)
return c.SendStatus(fiber.StatusInternalServerError)
}