-
Notifications
You must be signed in to change notification settings - Fork 308
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
ANSI Control Sequence parsing and Project Log timestamps #105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: David Fowler <davidfowl@gmail.com>
// Enable Simple Console Logger Formatting with a UTC timestamp similar to RFC3339Nano that Docker generates | ||
context.EnvironmentVariables["LOGGING__CONSOLE__FORMATTERNAME"] = "simple"; | ||
context.EnvironmentVariables["LOGGING__CONSOLE__FORMATTEROPTIONS__TIMESTAMPFORMAT"] = "yyyy-MM-dd'T'HH:mm:ss.ffffff'Z' "; | ||
context.EnvironmentVariables["LOGGING__CONSOLE__FORMATTEROPTIONS__USEUTCTIMESTAMP"] = "true"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this configurable? I would rather see the time stamps in my own time zone when running locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the same, it should be local
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it was my intention that it'd be configurable eventually. I just started off for this PR with matching the docker logs (RFC3339 and UTC, which doesn't appear to be configurable) since it seemed being able to compare timestamps would be useful. I filed #115 to track making the project logs timestamp format/tz configurable.
The primary purpose of this PR is enabling ANSI Control Sequence parsing to pass colors through from project logs to the log viewer. It does a few other things along the way, so here's the rundown:
The formatting of project logs with timestamps enabled looks off. It's clear that lines 2-n of each log entry were indented based on the info/warn/dbug/etc messages in line 1 but NOT anticipating the timestamps. We may want to consider adjusting the indentation ourselves in this case, but I'll save that for another PR after feedback (need to see what would happen with the docker logs in the same scenario as well).
Resolves https://github.com/dotnet/aspire-private-planning/issues/664 and resolves https://github.com/dotnet/aspire-private-planning/issues/610