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 ConsoleWriter color on Windows #390

Merged
merged 2 commits into from Dec 19, 2021
Merged

Fix ConsoleWriter color on Windows #390

merged 2 commits into from Dec 19, 2021

Conversation

nichady
Copy link
Contributor

@nichady nichady commented Dec 19, 2021

Fixes #153

This fixes colored output when using ConsoleWriter on Windows by using https://github.com/mattn/go-colorable

Before:
image

After:
image

@rs rs merged commit 665519c into rs:master Dec 19, 2021
@aleblanc70
Copy link

aleblanc70 commented Jan 27, 2022

Can we have it under a Tag ?
Also I do not think it work in windows. I forked the project so I can replace it in my windows project...

C:\Users\AndreLeblanc\go\pkg\mod\github.com\aleblanc70\zerolog@v1.26.4>C:\Users\AndreLeblanc\sdk\go1.16\bin\go test console_test.go
--- FAIL: TestConsoleWriter (0.00s)
--- FAIL: TestConsoleWriter/Write_caller_field (0.00s)
console_test.go:273: Unexpected error when writing output: cannot decode event: invalid character 'U' in string escape code
console_test.go:279: Unexpected output "", want: "12:00AM DBG foo/bar.go > Foobar foo=bar\n"
FAIL
FAIL command-line-arguments 0.039s
FAIL

Will it be possible to have a Windows env. for the test ?

pablitoc pushed a commit to nxcr-org/zerolog that referenced this pull request Apr 7, 2023
* fix ConsoleWriter colors on windows
* fix ConsoleWriter color when created with struct literal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows color
3 participants