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

Add a short format for timestamps #247

Closed
tksm opened this issue Mar 11, 2023 · 0 comments · Fixed by #249
Closed

Add a short format for timestamps #247

tksm opened this issue Mar 11, 2023 · 0 comments · Fixed by #249
Assignees
Labels
kind/feature New feature or request

Comments

@tksm
Copy link
Contributor

tksm commented Mar 11, 2023

What would you like to be added:

I would like to add a short format for timestamps for readability, such as 01-02 15:04:05. It might be a form --timestamps=short or a new flag like --short-timestamps.

Though the current format for timestamps 2006-01-02T15:04:05.000000000Z07:00 is easy to be parsed by programs, it is a bit lengthy for humans.

Candidates for the short timestamp format are as follows. I prefer the 01-02 15:04:05 format.

format (Go’s time format) note
01-02 15:04:05 time.DateTime without year
2006-01-02 15:04:05 time.DateTime
Jan _2 15:04:05 time.Stamp (no ambiguity in the order of month and date)
15:04:05 time.TimeOnly
2006-01-02T15:04:05.000000000Z07:00 RFC3339Nano but with trailing zeros (Current format)

We can also colorize the timestamp field to improve the readability, but I guess discussing it in another issue is better.

Why is this needed:

The flag --timestamps is helpful because it converts times to local time by default. But the format is a bit long to use in daily use.

Here is the example of the current output with --timestamps.

kindnet-flqlg kindnet-cni 2023-03-11T09:52:10.563885300+09:00 I0311 00:52:10.563620       1 main.go:250] Node kind-worker2 has CIDR [10.244.2.0/24]
kindnet-flqlg kindnet-cni 2023-03-11T09:52:10.563897200+09:00 I0311 00:52:10.563760       1 main.go:223] Handling node with IPs: map[172.20.0.3:{}]
kindnet-flqlg kindnet-cni 2023-03-11T09:52:10.563908200+09:00 I0311 00:52:10.563790       1 main.go:250] Node kind-worker3 has CIDR [10.244.1.0/24]

If we have a short format like 01-02 15:04:05, it would be much easier to read.

kindnet-flqlg kindnet-cni 03-11 09:52:10 I0311 00:52:10.563620       1 main.go:250] Node kind-worker2 has CIDR [10.244.2.0/24]
kindnet-flqlg kindnet-cni 03-11 09:52:10 I0311 00:52:10.563760       1 main.go:223] Handling node with IPs: map[172.20.0.3:{}]
kindnet-flqlg kindnet-cni 03-11 09:52:10 I0311 00:52:10.563790       1 main.go:250] Node kind-worker3 has CIDR [10.244.1.0/24]
@tksm tksm added the kind/feature New feature or request label Mar 11, 2023
@tksm tksm self-assigned this Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant