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 tag with name of console command #146

Merged
merged 2 commits into from
Oct 8, 2018
Merged

Conversation

ejunker
Copy link
Contributor

@ejunker ejunker commented Jul 17, 2018

Listen for the CommandStarting event and add a tag with the name of the console command. This makes it easy to know which console command has the error.

Note: I did not typehint ComandStarting in commandStartingHandler because then I think it would only work on Laravel >=5.5 and based on the documentation this package supports Laravel 5.*. I'm surprised that the typehint of MessageLogged on messageLoggedHandler does not cause issues for people trying to use older versions of Laravel since MessageLogged was not added until Laravel 5.4.

ejunker and others added 2 commits July 17, 2018 10:06
Listen for the `CommandStarting` event and add a tag with the name of the console command. This makes it easy to know which console command has the error.

Note: I did not typehint `ComandStarting` in `commandStartingHandler` because then I think it would only work on Laravel >=5.5 and based on the documentation this package supports Laravel 5.*. I'm surprised that the typehint of `MessageLogged` on  `messageLoggedHandler` does not cause issues for people trying to use older versions of Laravel since `MessageLogged` was not added until Laravel 5.4.
@stayallive
Copy link
Collaborator

stayallive commented Oct 1, 2018

Hey @ejunker, thanks for taking the time to make this PR.

Because of autoloading you can use a non-existing class and that won't cause problems since the method is never called causing the class to resolve and not be found. So I added the type-hint cause why not :)

Also I added the CommandFinished event to reset the command in case it was called from a web request, sounds good?

(maybe you also want to take a look at #153 which adds event listeners for queue events)

@stayallive stayallive self-requested a review October 1, 2018 15:34
@stayallive stayallive merged commit e637d0e into getsentry:master Oct 8, 2018
@ejunker ejunker deleted the patch-1 branch October 18, 2018 00:58
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

Successfully merging this pull request may close these issues.

2 participants