Skip to content

Add debugging mode to connection settings #2538

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

Merged
merged 2 commits into from
Jan 18, 2017
Merged

Conversation

gmarz
Copy link
Contributor

@gmarz gmarz commented Jan 13, 2017

This commit adds the ability to set .EnableDebugMode() on
ConnectionSettings which turns direct streaming and pretty JSON on and
writes DebugInformation to the output window.

It also accepts an optional Action to perform when the
request is completed, but preserves the original OnRequestCompleted action
that might be set on ConnectionSettings.

Closes #2535

This commit adds the ability to set .EnableDebugMode() on
ConnectionSettings which turns direct streaming and pretty JSON on and
writes DebugInformation to the output window.

It also accepts an optional Action<IApiCallDetails> to perform when the
request is completed, but preserves the original OnRequestCompleted action
that might be set on ConnectionSettings.

Closes #2535
{
originalCompletedRequestHandler?.Invoke(d);
onRequestCompleted?.Invoke(d);
System.Diagnostics.Debug.WriteLine(d.DebugInformation);
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to let the user do this in their delegate themselves

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Write to the debug output, or preserve the original request handler? Or both? :)

Copy link
Member

Choose a reason for hiding this comment

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

Write to debug output :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I sort of like that we write to it automatically as part of "debug mode", but I see the argument against it. I'll remove it and update the PR 👍.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or we can make the default handler write the debug info, and let the user supplied one override it?

Copy link
Member

Choose a reason for hiding this comment

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

that works for me 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done with my last commit

@Mpdreamz Mpdreamz merged commit f5ea899 into master Jan 18, 2017
Mpdreamz pushed a commit that referenced this pull request Jan 18, 2017
* Add debugging mode to connection settings

This commit adds the ability to set .EnableDebugMode() on
ConnectionSettings which turns direct streaming and pretty JSON on and
writes DebugInformation to the output window.

It also accepts an optional Action<IApiCallDetails> to perform when the
request is completed, but preserves the original OnRequestCompleted action
that might be set on ConnectionSettings.

Closes #2535

* move debug.write to default request completed handler
Mpdreamz pushed a commit that referenced this pull request Jan 18, 2017
* Add debugging mode to connection settings

This commit adds the ability to set .EnableDebugMode() on
ConnectionSettings which turns direct streaming and pretty JSON on and
writes DebugInformation to the output window.

It also accepts an optional Action<IApiCallDetails> to perform when the
request is completed, but preserves the original OnRequestCompleted action
that might be set on ConnectionSettings.

Closes #2535

* move debug.write to default request completed handler
@Mpdreamz
Copy link
Member

ported to 2.x and 5.x

@Mpdreamz Mpdreamz deleted the feature/debug-mode branch January 18, 2017 08:52
awelburn pushed a commit to Artesian/elasticsearch-net that referenced this pull request Nov 6, 2017
* Add debugging mode to connection settings

This commit adds the ability to set .EnableDebugMode() on
ConnectionSettings which turns direct streaming and pretty JSON on and
writes DebugInformation to the output window.

It also accepts an optional Action<IApiCallDetails> to perform when the
request is completed, but preserves the original OnRequestCompleted action
that might be set on ConnectionSettings.

Closes elastic#2535

* move debug.write to default request completed handler
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