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

add env for logging to file and syslog #46

Merged
merged 1 commit into from
Sep 12, 2018
Merged

add env for logging to file and syslog #46

merged 1 commit into from
Sep 12, 2018

Conversation

frrist
Copy link
Member

@frrist frrist commented Sep 11, 2018

What's this?

@frrist frrist added the kind/enhancement A net-new feature or improvement to an existing feature label Sep 11, 2018
@frrist frrist self-assigned this Sep 11, 2018
@ghost ghost added the status/in-progress In progress label Sep 11, 2018
@frrist frrist changed the title add env for logging to file (fix #22) and syslog add env for logging to file and syslog Sep 11, 2018
oldlog.go Outdated
if err != nil {
fmt.Printf("ERROR go-log: %s: failed to set logging file backend\n", err)
}
lgbe = append(lgbe, logging.NewLogBackend(f, "", 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the above errors, we don't want to add this backend. it will be to a bad file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! thanks

oldlog.go Outdated
if logfp := os.Getenv(envLoggingFile); len(logfp) > 0 {
f, err := os.Create(logfp)
if err != nil {
fmt.Printf("ERROR go-log: %s: failed to set logging file backend\n", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should at least use stderr. Ideally, we'd log it but it may be too early for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed - will write to stderr, I think it may be too early to log here.

@frrist frrist merged commit dda4893 into master Sep 12, 2018
@ghost ghost removed the status/in-progress In progress label Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add env var for output to file
4 participants