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

removed trimspace in write method #38

Open
wants to merge 2 commits into
base: v1
Choose a base branch
from
Open

Conversation

Bobby-88
Copy link

@Bobby-88 Bobby-88 commented May 3, 2020

This fixes #37
Trimspace causes number of bytes wirtten to be not equal to number of bytes requested to write - this causes an error in multiwriter
Happy to help with other tests if needed

trimspace causes number of bytes wirtten to be not equal to number of bytes requested to write - this causes an error in multiwriter
@CLAassistant
Copy link

CLAassistant commented May 3, 2020

CLA assistant check
All committers have signed the CLA.

@Bobby-88
Copy link
Author

Bobby-88 commented May 4, 2020

@mariussturm i've just noticed that somehow this PR also will update README.md - this was not my intent, please ignore commit #8a6a140bfa5cdfce8768648e8a7ddf3c13b04be9

@mariussturm
Copy link

@Bobby-88 under what conditions exactly do you have problems with the trimspace?
Messages starting with whitespaces look odd in the Graylog web interface so we trim them usually.

@Bobby-88
Copy link
Author

Bobby-88 commented Jun 11, 2020

@Bobby-88 under what conditions exactly do you have problems with the trimspace?
Messages starting with whitespaces look odd in the Graylog web interface so we trim them usually.

Sorry for delay.
Here is a piece of code which gives me warnings if i don't trim whitespaces

gelfWriter, err := gelf.NewWriter("192.168.20.6:12201")
	if err != nil {
		log.Error().Msgf("gelf.NewWriter: %s", err)
	}
log.Logger = zerolog.New(os.Stdout).With().Timestamp().Logger().Output(zerolog.MultiLevelWriter(zerolog.ConsoleWriter{Out: os.Stderr, NoColor: true}, gelfWriter))

@thaod
Copy link

thaod commented Jun 30, 2020

@Bobby-88 under what conditions exactly do you have problems with the trimspace?
Messages starting with whitespaces look odd in the Graylog web interface so we trim them usually.

@mariussturm I think the writer should respect provided data to send it as is, even with leading white spaces. Problem with odd UI should be resolved in the Graylog web interface logic, not log writer.

@mjjs
Copy link

mjjs commented Sep 3, 2020

This seems sensible. Especially if the only reason to trim it is to fix the UI. As thaod pointed out, it's more logical to do this in the UI code.

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.

when working with zerolog - getting a lot of "short write" errors
6 participants