Skip to content

🚀 [Feature]: Add Logger interface #2433

@kousikmitra

Description

@kousikmitra

Feature Description

As pointed out by @efectn in #2402 and #2432 (comment) xurrently we log everything using default logger like log.Print*, this makes it hard to replace the standard logger with any other logger like logrus, zap etc.

We can add a logger interface and give an option to replace the default logger via fiber.Config

Additional Context (optional)

No response

Code Snippet (optional)

package main

import "github.com/gofiber/fiber/v2"
import "log"

func main() {
  // Enable fiber to use slog to log messages.
  app := fiber.New(fiber.Config{Logger: slog.New()})

  log.Fatal(app.Listen(":3000"))
}

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions