hashicorp / go-plugin

Golang plugin system over RPC.
Mozilla Public License 2.0
5.25k stars 450 forks source link

Print panic output on Error log level #292

Open hanzei opened 11 months ago

hanzei commented 11 months ago

First of all, thanks for creating this awesome library! We at Mattermost use it a lot.

If a plugin panics, the panic message goes to stderr of the plugin. Because the log lines don't have any levelled prefix like [ERROR], the panic message would end up in the Debug level. That makes it hard to spot, why a plugin panicked.

The (hacky) solution is to check if any unparsed lines start with panic:. If that is the case, this line and all unparsed following lines go to the Error level. Most likely, these will be the last log lines anyway before the process dies.

I tried adding a test to cover, but that would require spinning up another process (that then panics) to cover this PR.

hashicorp-cla commented 11 months ago

CLA assistant check
All committers have signed the CLA.

hanzei commented 10 months ago

@tomhjp Would you mind giving this PR a review?

hanzei commented 1 month ago

Anything I can help with to get a review going?

streamer45 commented 3 days ago

@VioletHynes Would your team have some bandwidth to review this one?

VioletHynes commented 3 days ago

Hi there -- this isn't my team's area but I'll try and forward this to the team that owns this. Thanks :)

streamer45 commented 2 days ago

Thanks, appreciate it!