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

QuoteEmptyFields attribute does not work #34

Open
shazib-summar opened this issue Jan 28, 2023 · 1 comment
Open

QuoteEmptyFields attribute does not work #34

shazib-summar opened this issue Jan 28, 2023 · 1 comment

Comments

@shazib-summar
Copy link

shazib-summar commented Jan 28, 2023

QuoteEmptyFields does not quote empty fields even when set to true explicitly. The following code

package main

import (
	"time"

	"github.com/sirupsen/logrus"
	prefixed "github.com/x-cray/logrus-prefixed-formatter"
)

func init() {
	logrus.SetFormatter(&prefixed.TextFormatter{
		TimestampFormat:  time.RFC3339,
		FullTimestamp:    true,
		ForceFormatting:  true,
		QuoteEmptyFields: true,
	})
	logrus.SetLevel(logrus.DebugLevel)

}

func main() {
	logrus.WithFields(logrus.Fields{
		"prefix":      "main",
		"emptyfield1": "",
		"emptyfield2": "",
		"number":      0,
	}).Debug("Started observing beach")
}

outputs

[2023-01-28T18:32:38+05:00] DEBUG main: Started observing beach emptyfield1= emptyfield2= number=0

Notice the empty fields are not quoted. Am I missing something here?

@shazib-summar shazib-summar changed the title QuoteEmptyField attribute does not work QuoteEmptyFields attribute does not work Jan 28, 2023
@shazib-summar
Copy link
Author

@x-cray pls help?

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

1 participant