Skip to content

Conversation

@bahusoid
Copy link
Member

@bahusoid bahusoid commented May 16, 2020

Minimize clutter of Log.IsDebugEnabled calls and get rid of typing logic in GetReaderStopwatch


var cmd = _factory.ConnectionProvider.Driver.GenerateCommand(type, sql, parameterTypes);
LogOpenPreparedCommand();
if (Log.IsDebugEnabled())
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to LogOpenPreparedCommand

}
finally
{
if (Log.IsDebugEnabled() && duration != null)
Copy link
Member Author

Choose a reason for hiding this comment

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

duration is created only under Debug logging. I see no point in additional code cluttering with Log.IsDebugEnabled()

Log.Error(e, "Could not execute query: {0}", cmd.CommandText);
throw;
}
finally
Copy link
Member Author

@bahusoid bahusoid May 16, 2020

Choose a reason for hiding this comment

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

Useless finally block (as in case exception reader is null). Moved logic to LogOpenReader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants