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

logging: Improve logging capabilities #40

Open
notYuriy opened this issue May 13, 2021 · 2 comments
Open

logging: Improve logging capabilities #40

notYuriy opened this issue May 13, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@notYuriy
Copy link
Contributor

As of now, there are many log statements that make screen dirty.
The proposal is to add "trace" argument to os.log or make a new function os.trace that will be similar to os.log but will have a "trace" argument. log/trace will then be used like this.

os.trace("range_alloc", "Allocated new range 0x{X} - -x{X}", .{range_start, range_end});

On startup, stivale2_main would parse cmdline to find all enabled traces. If trace is enabled, thing will be logged, otherwise it trace becomes a no-op.
The alternative is to define list of traces in compile-time config and checking if something should be printed at compile-time. This would remove all run-time overhead + stivale2 cmdline parser would not be needed. On the other hand, kernel would have to be recompiled every time we want to see output for some traces which is not really convinient in all cases. Additionally, we would need a stivale2 cmdline parser later on anyways

@notYuriy notYuriy added enhancement New feature or request good first issue Good for newcomers labels May 13, 2021
@N00byEdge
Copy link
Member

N00byEdge commented May 13, 2021

Alternatively: Have each trace configurable on/off from config.zig at comptime

@notYuriy
Copy link
Contributor Author

notYuriy commented Jun 4, 2021

Turns out that the standard library provides all functionality needed under namespace std.log.*, we just need to define a root log callback for logging functions to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants