Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 Fix: default logger color behaviour #2513

Merged
merged 2 commits into from
Jun 22, 2023
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jun 21, 2023

Description

#2493 introduces DisableColors, but it's default value is set to true, which contradicts the documentation:

https://docs.gofiber.io/api/middleware/logger#config

// DisableColors defines if the logs output should be colorized
//
// Default: false
DisableColors bool

https://docs.gofiber.io/api/middleware/logger#default-config, as well as https://github.com/gofiber/fiber/blob/master/middleware/logger/config.go#L94

var ConfigDefault = Config{
	Next:         nil,
	Done:         nil,
	Format:       "[${time}] ${status} - ${latency} ${method} ${path}\n",
	TimeFormat:   "15:04:05",
	TimeZone:     "Local",
	TimeInterval: 500 * time.Millisecond,
	Output:       os.Stdout,
    	DisableColors: true,
}

and therefore, coloring is disabled by default, and can only be enabled by explicitly setting DisableColors to false

app.Use(logger.New(logger.Config{DisableColors: false}))

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation - /docs/ directory for https://docs.gofiber.io/
  • New and existing unit tests pass locally with my changes

Commit formatting:

Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/

@ReneWerner87
Copy link
Member

@cmd777 can you look at the tests
image

Basically add ˙enableColors: true˙ back to default config
@ghost
Copy link
Author

ghost commented Jun 22, 2023

@ReneWerner87 okay, the logger tests were fixed
Screenshot from 2023-06-22 11-34-10

just another test file failed with Test_Ctx_SendFile_RestoreOriginalURL
Screenshot from 2023-06-22 11-36-00

@ReneWerner87 ReneWerner87 merged commit 1b060cb into gofiber:master Jun 22, 2023
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant