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

customize the time param format in SQL log #6508

Closed

Conversation

wangyuehong
Copy link
Contributor

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Add feature to allow customization of the time parameter format in the SQL log.

User Case Description

logger/sql.go Outdated Show resolved Hide resolved
Co-authored-by: Gabriel Aquino Oliveira <[email protected]>
@saeidee
Copy link
Member

saeidee commented Aug 22, 2023

Please resolve the conflict.

tmFmtWithMS = "2006-01-02 15:04:05.999"
tmFmtZero = "0000-00-00 00:00:00"
nullStr = "NULL"
tmFmtZero = "0000-00-00 00:00:00"
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about using the same tmFmtZero and TimeParamFormat format? IMO This would make confusion later if the TimeParamFormat is not used for zero values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think about using the same tmFmtZero and TimeParamFormat format? IMO This would make confusion later if the TimeParamFormat is not used for zero values.

@saeidee
Thank you for your comment. I have considered your suggestion, but using the same TimeParamFormat for zero time values would lead to a breaking change, so I have maintained the current behavior for now.

before: 0000-00-00 00:00:00
after:  0001-01-01 00:00:00

@jinzhu
Copy link
Member

jinzhu commented Aug 25, 2023

Use a global variable to customize time format sounds tricky ;(

Maybe we need to figure out another solution...

@wangyuehong
Copy link
Contributor Author

Use a global variable to customize time format sounds tricky ;(
Maybe we need to figure out another solution...

@jinzhu

Thanks for your feedback. I agree that using a global variable is a quick but inelegant solution. If you have any alternative agree in mind, pls let me know and I want to improve this implementation.

@wangyuehong wangyuehong deleted the customize-logger-time-format branch October 13, 2023 14:52
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.

5 participants