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

refactor recent changes to martian logging #396

Merged
merged 16 commits into from Sep 7, 2023
Merged

refactor recent changes to martian logging #396

merged 16 commits into from Sep 7, 2023

Conversation

Choraden
Copy link
Contributor

@Choraden Choraden commented Sep 6, 2023

Fixes #394

Example log message:

[proxy] [DEBUG] [18a6b0c67a1] msg

Comment on lines 44 to 46
if v := ctx.Value(TraceContextKey); v != nil {
format = fmt.Sprintf("[%s] %s", v, format)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is repeated 3 times, maybe extract that to function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@mmatczuk
Copy link
Contributor

mmatczuk commented Sep 7, 2023

This probably can be squashed

martian(handler): use context logging functions Hubert Grochowski Yesterday 16:30
martian(proxy): use context logging functions Hubert Grochowski Yesterday 16:29

@mmatczuk
Copy link
Contributor

mmatczuk commented Sep 7, 2023

I suggest to move the cutting of martian log prefix to martian log functions instead of doing

cmd/forarder/run: apply more advanced logic to cut martian: prefix from martian logger. Hubert Grochowski Yesterday 17:16

This allows use to print logs with trace id.
Logs in these files does not need to be traced.
Since martian logger appends trace id to the format this in an easy patch to make the log line look ok.
[proxy] DEBUG: [18a6b0c67a1] msg -> [proxy] [DEBUG] [18a6b0c67a1] msg
This makes the logs more flexible as one can add any prefix by Deocrate function in logger.
The martian prefix has been removed from the log lines for good.
It is no longer needed to decorate the logs.
@mmatczuk mmatczuk merged commit 08f1569 into main Sep 7, 2023
3 checks passed
@mmatczuk mmatczuk deleted the hg/fix-log branch September 7, 2023 10:04
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.

refactor recent changes to martian logging
2 participants