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

[gommon][log] log.Error does not panic nor exit #4

Open
at15 opened this issue May 9, 2018 · 3 comments
Open

[gommon][log] log.Error does not panic nor exit #4

at15 opened this issue May 9, 2018 · 3 comments
Assignees

Comments

@at15
Copy link
Member

at15 commented May 9, 2018

@gaocegege I saw several usage of log.Error , I am not sure if you are just logging it or you want to the program to exit directly, if it's the latter one, you should call log.Panic or log.Fatal. log.Error is based on logrus where it is a log message with a red prefix.

switch actionType {
case "closed":
	if err := p.processEventClosed(issue); err != nil {
		return err
	}
default:
	log.Errorf("action type %s is not supported yet", actionType)
}
return nil
func GetGitHubClient() *Client {
	if gitHubClient == nil {
		log.Error("GitHubClient is not initialized")
	}
	return gitHubClient
}
@at15 at15 added the discussion label May 9, 2018
@gaocegege
Copy link
Member

I do not want to panic when i am using errorf. Actually it is a long running service and should never be stopped even there is an error.

@at15
Copy link
Member Author

at15 commented May 9, 2018

@gaocegege I think for the GetGitHubClient one, it should panic instead of logging as error, it would cause panic eventually when the caller use the returned null pointer as a client.

@gaocegege
Copy link
Member

Yeah, that's cool.

@gaocegege gaocegege self-assigned this Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants