mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
fail to make the logger log good
i hate GO
This commit is contained in:
@@ -2,6 +2,8 @@ module codeberg.org/vnpower/pixivfe/v2
|
||||
|
||||
go 1.21
|
||||
|
||||
replace github.com/gofiber/fiber/v2 => github.com/iacore/fiber/v2 v2.0.0-20240221154744-f7bf0b188c39
|
||||
|
||||
require (
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/gofiber/fiber/v2 v2.52.0
|
||||
|
||||
@@ -8,8 +8,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE=
|
||||
github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
|
||||
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
|
||||
github.com/gofiber/template/jet/v2 v2.1.8 h1:UCAu62v2RwJXsYVo+9zSEqA8WtNLul0KPsgTJAGowAs=
|
||||
@@ -18,6 +16,8 @@ github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
|
||||
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
|
||||
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/iacore/fiber/v2 v2.0.0-20240221154744-f7bf0b188c39 h1:pw9lhXGyS1P1s1g/h7nBjPJKJBg5UVsrLocuJxv6SQc=
|
||||
github.com/iacore/fiber/v2 v2.0.0-20240221154744-f7bf0b188c39/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
|
||||
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
|
||||
@@ -124,8 +124,15 @@ func main() {
|
||||
|
||||
server.Use(logger.New(
|
||||
logger.Config{
|
||||
Format: "${time} ${ip} | ${path}\n",
|
||||
Format: "${time} ~${latencySI} ${ip} ${method} ${path} ${status} ${error} \n",
|
||||
Next: CanRequestSkipLogger,
|
||||
EnableLatency: true,
|
||||
CustomTags: map[string]logger.LogFunc{
|
||||
"latencySI": func(output logger.Buffer, c *fiber.Ctx, data *logger.Data, extraParam string) (int, error) {
|
||||
latency := data.Stop.Sub(data.Start).Seconds()
|
||||
return output.WriteString(fmt.Sprintf("%.13f", latency))
|
||||
},
|
||||
},
|
||||
},
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user