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

feat: adds SetLogTimestampFormat to cli, implements #2795 #20

Closed
wants to merge 2 commits into from

Conversation

aistein
Copy link

@aistein aistein commented Apr 28, 2020

This PR moves towards addressing Argo Workflows Issue #2796.

It adds the function SetLogTimestampFormat which could easily be called with the desired millisecond timestamp format requested in the issue, but can be formatted in any way desired by users across the various argoproj repositories. The fact that it is a separate function means it will not break any existing code using pkg.

/review @alexec @simster7

cli/cli.go Outdated
func SetLogTimestampFormat(format string) {
log.SetFormatter(&log.TextFormatter{
TimestampFormat: format,
FullTimestamp: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be a parameter?

Copy link
Author

Choose a reason for hiding this comment

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

@alexec d you mean the whole Formatter object? Something like this instead:

// SetFormatter sets the logrus log formatter
func SetFormatter(formatter log.Formatter) {
	log.SetFormatter(formatter)
}

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 he may mean that we might want to have a flag to set FullTimestamp on or off

Copy link
Author

Choose a reason for hiding this comment

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

got it, thanks!

@sonarcloud
Copy link

sonarcloud bot commented Apr 29, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@aistein aistein requested review from simster7 and alexec April 29, 2020 03:31
@alexec
Copy link
Contributor

alexec commented Apr 29, 2020

I don't think we need this PR - you can call logrus directly surely?

@aistein
Copy link
Author

aistein commented May 5, 2020

@alexec you are absolutely right! sorry for putting this in the wrong place. I've opened a new PR on the argo repo - argoproj/argo-workflows#2950

@aistein aistein closed this May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants