update: remove fiber's log module
This commit is contained in:
parent
d0fd8f2b0a
commit
756ba61b23
2
go.mod
2
go.mod
@ -3,13 +3,13 @@ module git.matterlinux.xyz/matter/tracker
|
||||
go 1.21.6
|
||||
|
||||
require (
|
||||
github.com/bigkevmcd/go-configparser v0.0.0-20230427073640-c6b631f70126
|
||||
github.com/gofiber/fiber/v2 v2.52.0
|
||||
github.com/gofiber/template/html/v2 v2.1.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/andybalholm/brotli v1.0.5 // indirect
|
||||
github.com/bigkevmcd/go-configparser v0.0.0-20230427073640-c6b631f70126 // indirect
|
||||
github.com/gofiber/template v1.8.2 // indirect
|
||||
github.com/gofiber/utils v1.1.0 // indirect
|
||||
github.com/google/uuid v1.5.0 // indirect
|
||||
|
6
go.sum
6
go.sum
@ -16,6 +16,10 @@ github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
|
||||
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
@ -39,5 +43,7 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
12
lib/repo.go
12
lib/repo.go
@ -4,13 +4,13 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/bigkevmcd/go-configparser"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@ -105,7 +105,7 @@ func GetRepo(r Repo) ([]Package, error){
|
||||
|
||||
pkg, err := LoadPackgae(repo, s)
|
||||
if err != nil {
|
||||
log.Errorf("Error loading %s: %s", s, err)
|
||||
log.Printf("Error loading %s: %s", s, err)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -123,13 +123,13 @@ func LoadRepos() {
|
||||
|
||||
data, err := os.ReadFile("cfg.json")
|
||||
if err != nil {
|
||||
log.Error("Failed to read the configuration")
|
||||
log.Printf("Failed to read the configuration")
|
||||
}
|
||||
|
||||
var cfg Config
|
||||
err = json.Unmarshal(data, &cfg)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to parse the configuration: %s", err)
|
||||
log.Printf("Failed to parse the configuration: %s", err)
|
||||
}
|
||||
|
||||
Repos = cfg.Repos
|
||||
@ -142,11 +142,11 @@ func LoadAllPkgs() {
|
||||
for _, r := range Repos {
|
||||
pkgs, err := GetRepo(r)
|
||||
if err != nil {
|
||||
log.Errorf("Error loading %s: %s", r.Name, err.Error())
|
||||
log.Printf("Error loading %s: %s", r.Name, err.Error())
|
||||
continue
|
||||
}
|
||||
Packages = append(Packages, pkgs...)
|
||||
}
|
||||
|
||||
log.Infof("Loaded total %d packages", len(Packages))
|
||||
log.Printf("Loaded total %d packages", len(Packages))
|
||||
}
|
||||
|
10
main.go
10
main.go
@ -16,17 +16,17 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.matterlinux.xyz/matter/tracker/lib"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/log"
|
||||
"github.com/gofiber/template/html/v2"
|
||||
)
|
||||
|
||||
@ -95,6 +95,8 @@ func GETIndex(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func main(){
|
||||
log.SetFlags(log.Ltime | log.Lshortfile)
|
||||
|
||||
engine := html.New("./templates", ".html")
|
||||
app := fiber.New(fiber.Config{
|
||||
DisableStartupMessage: true,
|
||||
@ -109,10 +111,10 @@ func main(){
|
||||
})
|
||||
|
||||
go UpdateLoop()
|
||||
log.Info("Starting MatterLinux Package Tracker on port 9877")
|
||||
log.Println("Starting MatterLinux Package Tracker on port 9877")
|
||||
err := app.Listen(":9877")
|
||||
if err != nil {
|
||||
log.Errorf("Error starting server: %s", err)
|
||||
log.Printf("Error starting server: %s", err)
|
||||
}
|
||||
close(stopchan)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user