mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-23 15:43:42 +00:00
Set logger config default values
This commit is contained in:
parent
3a6ae283b1
commit
566db0ae96
@ -108,6 +108,19 @@ func Logger(format ...string) fiber.Handler {
|
|||||||
|
|
||||||
// LoggerWithConfig allows you to pass an CompressConfig
|
// LoggerWithConfig allows you to pass an CompressConfig
|
||||||
func LoggerWithConfig(config LoggerConfig) fiber.Handler {
|
func LoggerWithConfig(config LoggerConfig) fiber.Handler {
|
||||||
|
// Set config default values
|
||||||
|
if config.Format == "" {
|
||||||
|
config.Format = LoggerConfigDefault.Format
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.TimeFormat == "" {
|
||||||
|
config.TimeFormat = LoggerConfigDefault.TimeFormat
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.Output == nil {
|
||||||
|
config.Output = LoggerConfigDefault.Output
|
||||||
|
}
|
||||||
|
|
||||||
// Middleware settings
|
// Middleware settings
|
||||||
var mutex sync.RWMutex
|
var mutex sync.RWMutex
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user