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: switch from env_logger to tracing logger #194

Merged
merged 5 commits into from
Apr 25, 2024

Conversation

ctron
Copy link
Contributor

@ctron ctron commented Apr 23, 2024

Instead of pushing tracing events to log, and from log to env_logger, this consumes log into tracing, and then logs those with trace spans in mind.

This mostly means that trace spans only get logged when they fail.

It still uses the RUST_LOG variable, and defaults to INFO.

On top of that, there's color:

image

Copy link
Contributor

@jcrossley3 jcrossley3 left a comment

Choose a reason for hiding this comment

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

Trying it locally, I see some log messages with color, but some without, specifically those from trustify_module_graph. Is that expected?

@ctron
Copy link
Contributor Author

ctron commented Apr 23, 2024

Trying it locally, I see some log messages with color, but some without, specifically those from trustify_module_graph. Is that expected?

No, that sounds strange. Can you share more details? Screenshot maybe?

@ctron ctron marked this pull request as draft April 23, 2024 16:05
@ctron
Copy link
Contributor Author

ctron commented Apr 23, 2024

I moved this back to draft, as I am actually missing some log records. I need some more time to check this. Still, a screenshot would be good.

@ctron
Copy link
Contributor Author

ctron commented Apr 23, 2024

I found the reason for the missing log events. I also re-added the target, I think it's useful (the module/crate). However, I still don't see any non-colored events.

@ctron ctron marked this pull request as ready for review April 24, 2024 08:29
@ctron
Copy link
Contributor Author

ctron commented Apr 24, 2024

The issue with the missing logs is now solved. I can't reproduce the other (non colored logs).

@ctron
Copy link
Contributor Author

ctron commented Apr 24, 2024

This PR also contains a fix for the server not starting up with auth-disabled when no SSO server is running.

@jcrossley3
Copy link
Contributor

Trying it locally, I see some log messages with color, but some without, specifically those from trustify_module_graph. Is that expected?

No, that sounds strange. Can you share more details? Screenshot maybe?

Screenshot from 2024-04-24 10-10-54

@bobmcwhirter
Copy link
Contributor

Is this an artifact of test-log not using the same logger?

@ctron
Copy link
Contributor Author

ctron commented Apr 24, 2024

Ah yes, that's a bug in test-log: d-e-s-o/test-log#48 …let's see if that gets merged.

Basically there are two frameworks mixed: log and tracing.

@ctron
Copy link
Contributor Author

ctron commented Apr 24, 2024

However, this scope of this PR also is only the binary, not the tests. And yes, we should have the same behavior for tests IMO. But that requires the patch/fix on the test_log side.

ctron added 5 commits April 25, 2024 17:12
Instead of pushing tracing events to log, and from log to env_logger,
this consumes log into tracing, and then logs those with trace spans
in mind.

This mostly means that trace spans only get logged when they fail.

It still uses the RUST_LOG variable, and defaults to INFO.

On top of that, there's color.
* drop unnecessary env_logger
* sort
@ctron ctron force-pushed the feature/use_trace_logger_1 branch from 84c7410 to 48abe0d Compare April 25, 2024 15:21
@ctron ctron enabled auto-merge April 25, 2024 15:21
@ctron ctron added this pull request to the merge queue Apr 25, 2024
Merged via the queue into trustification:main with commit 1929f8b Apr 25, 2024
1 check passed
@ctron ctron deleted the feature/use_trace_logger_1 branch April 25, 2024 15:33
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.

3 participants