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

When using Diode, Fatal doesn't output anything #324

Closed
reflog opened this issue Jun 3, 2021 · 2 comments
Closed

When using Diode, Fatal doesn't output anything #324

reflog opened this issue Jun 3, 2021 · 2 comments

Comments

@reflog
Copy link

reflog commented Jun 3, 2021

Here's a small test to demonstrate:

package main

import (
	"fmt"
	"os"

	"github.com/rs/zerolog"
	"github.com/rs/zerolog/diode"
)

func main() {
	w := diode.NewWriter(os.Stdout, 1000, 0, func(missed int) {
		fmt.Printf("Dropped %d messages\n", missed)
	})
	log := zerolog.New(w)
	log.Print("this will print")
	log.Fatal().Msg("this will not")
	w.Close()
}

https://play.golang.org/p/pYkYlBrde_7

@cesher
Copy link

cesher commented Sep 15, 2021

Fatal calls panic() internally, that won't give diode enough time to flush the buffer.

To work around this in my project I use logger.WithLevel(zerolog.FatalLevel).

@reflog reflog closed this as completed Oct 17, 2021
@gmbuell
Copy link
Contributor

gmbuell commented Jan 13, 2024

FYI this is fixed in #634

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

3 participants