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

Closes #214: Log execution time of all CRUD APIs #216

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

jafri-zz
Copy link
Contributor

Log execution timer implementation to address issue #214

logger.log(
"""
${api.redactedCopyOrThis(logger.redactMessages)}
execution time: $executionTime
Copy link
Owner

Choose a reason for hiding this comment

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

AWESOME!!!

internal fun onPostExecute(result: CrudApi.Result) {
listeners.forEach { it.onPostExecute(result) }
internal fun onPostExecute(api: CrudApi, result: CrudApi.Result) {
listeners.forEach { it.onPostExecute(api, result) }
Copy link
Owner

Choose a reason for hiding this comment

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

Nice!

internal fun CrudApi.Result.onPostExecute(contactsApi: Contacts) {
contactsApi.apiListenerRegistry.onPostExecute(this)
internal fun CrudApi.onPostExecute(contactsApi: Contacts, result: CrudApi.Result) {
contactsApi.apiListenerRegistry.onPostExecute(this, result)
Copy link
Owner

Choose a reason for hiding this comment

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

Cool!

@vestrel00 vestrel00 assigned vestrel00 and jafri-zz and unassigned vestrel00 Jun 10, 2022
@vestrel00 vestrel00 added the enhancement New feature or request label Jun 10, 2022
@vestrel00 vestrel00 added this to In review in General maintenance Jun 10, 2022
Copy link
Owner

@vestrel00 vestrel00 left a comment

Choose a reason for hiding this comment

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

THANK YOU FOR THIS AWESOME CONTRIBUTION!!!!

@vestrel00 vestrel00 merged commit c9db3e3 into vestrel00:main Jun 10, 2022
@vestrel00 vestrel00 moved this from In review to Done in General maintenance Jun 10, 2022
logRedactable(result)
}
override fun onPostExecute(api: CrudApi, result: CrudApi.Result) {
val executionTime = apiExecutionStartTimeMillis.remove(api)
Copy link
Owner

Choose a reason for hiding this comment

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

I'm an idiot for missing this lol. This is supposed to be something like;

val executionTime = System.currentTimeMillis() - apiExecutionStartTimeMillis.remove(api)

I'll fix it in main directly =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants