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 support for levels in the ConditionalDebug class. #438

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

davidchisnall
Copy link
Collaborator

The class is now instantiated with a threshold level, from None to Error (for backwards compatibility, true means Information and false means None).

Log messages also provide a log level (Information if none is provided) and will fire if the log level is greater than or equal to the threshold.

Copy link
Collaborator

@rmn30 rmn30 left a comment

Choose a reason for hiding this comment

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

Looks good. but I don't understand how it is backwards compatible with ConditionalDebug<false, "blah">. Looks like that would create an Information level ConditionalDebug?

Edit: I upgraded my understanding as below.

@@ -592,26 +666,31 @@ namespace
* using Debug = ConditionalDebug<DebugFoo, "Foo">;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this comment need updating?

sdk/include/debug.hh Outdated Show resolved Hide resolved
Copy link
Collaborator

@rmn30 rmn30 left a comment

Choose a reason for hiding this comment

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

Ah, that's what DebugLevelTemplateArgument is for. I still think you could update the comments.

@@ -676,6 +755,7 @@ namespace
}
}
};

/**
* Function-like class for assertions that is expected to be used via
* the deduction guide as:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be useful to give Assertions a DebugLevel, like log messages?

@PhilDay-CT
Copy link
Contributor

Would be nice if one or more of the examples was updated to show how this can be uses.

@davidchisnall davidchisnall force-pushed the debug-level branch 6 times, most recently from 45e3c3e to e51d9aa Compare February 7, 2025 14:38
The class is now instantiated with a threshold level, from None to Error
(for backwards compatibility, true means Information and false means
None).

Log messages also provide a log level (Information if none is provided)
and will fire if the log level is greater than or equal to the
threshold.

The build system now has a `debugLevelOption` that allows specifying
fine-grained levels.  The existing `debugOption` works as before.

The allocator is now extended to use `debugLevelOption`.
@davidchisnall davidchisnall merged commit f4a71e3 into main Feb 7, 2025
7 checks passed
@nwf nwf deleted the debug-level branch February 7, 2025 17:49
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