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

Support Logger from logging as writer for Process from processmanager. #415

Open
rewenset opened this issue Nov 19, 2019 · 0 comments
Open

Comments

@rewenset
Copy link
Contributor

rewenset commented Nov 19, 2019

Currently I've found solution to create wrapper for Logger such as:

type ProcessLogger struct {
	logging.Logger
}

func (pl *ProcessLogger) Write(p []byte) (n int, err error) {
	pl.Debug(string(p))
	return len(p), nil
}

and use this option when creating a new Process to set it for both out and err:

// Writer allows to use custom writer instance. Can be defined with nil parameters, in such a case
// standard output will be used
func Writer(outW, errW io.Writer) POption {
return func(p *POptions) {
p.outWriter, p.errWriter = outW, errW
}
}

It would be nice if this template code could be avoided.

I'm not sure if this requires changes in processmanager or logging packages.

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