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

MultiLevelWriter message within message? #376

Closed
fgsch opened this issue Nov 1, 2021 · 2 comments
Closed

MultiLevelWriter message within message? #376

fgsch opened this issue Nov 1, 2021 · 2 comments

Comments

@fgsch
Copy link
Contributor

fgsch commented Nov 1, 2021

I'm getting strange results with the MultiLevelWriter logger.
For example in this case:

package main

import (
	"github.com/rs/zerolog"
	"os"
)

func main() {
	multi := zerolog.MultiLevelWriter(zerolog.Nop(), zerolog.New(os.Stdout))
	logger := zerolog.New(multi)
	logger.Info().Msg("Hello World!")
}

I get:

{"message":"{\"level\":\"info\",\"message\":\"Hello World!\"}"}

It looks like it's wrapping the log within a message.
Am I doing something wrong or this is working as expected?

@rs
Copy link
Owner

rs commented Nov 2, 2021

Please search previous closed issues, this has been explained already.

@rs rs closed this as completed Nov 2, 2021
@fgsch
Copy link
Contributor Author

fgsch commented Nov 2, 2021

I did search for this but somehow missed #361.
I see the issue now. Thanks.

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

No branches or pull requests

2 participants