[EP Plugin Adapter] support LoggingManager::HasDefaultLogger()#27587
Merged
[EP Plugin Adapter] support LoggingManager::HasDefaultLogger()#27587
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the EP plugin adapter logging surface to expose LoggingManager::HasDefaultLogger() (mirroring the main ORT logging API shape) so plugin EP code can query whether a default logger is available.
Changes:
- Introduce
onnxruntime::ep::adapter::LoggingManagerwithHasDefaultLogger()and move default-logger management offLogger. - Update the adapter’s
LOGS_DEFAULT_CATEGORYmacro to useLoggingManager::DefaultLogger(). - Expose
LoggingManagervia EP-specific using declarations ininclude/onnxruntime/ep/adapters.h.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| include/onnxruntime/ep/adapters.h | Exposes LoggingManager in the EP plugin adapter’s logging namespace aliases. |
| include/onnxruntime/ep/adapter/logging.h | Adds adapter LoggingManager (with HasDefaultLogger) and routes default logging macros through it. |
Comments suppressed due to low confidence (1)
include/onnxruntime/ep/adapter/logging.h:47
LoggingManager::DefaultLogger()dereferencesinstance_without checking it is initialized, which is undefined behavior if logging is used beforeCreateDefaultLogger()is called. Also,CreateDefaultLogger()overwritesinstance_without deleting/guarding against an existing logger, which can leak if called more than once. Consider matching::onnxruntime::logging::LoggingManagerbehavior: throw (or otherwise fail fast) ifinstance_is null inDefaultLogger(), and either throw ifinstance_is already set or delete/requireDestroyDefaultLogger()before re-creating.
static bool HasDefaultLogger() { return nullptr != instance_; }
static const Logger& DefaultLogger() { return *instance_; }
static void CreateDefaultLogger(const OrtLogger* logger) {
instance_ = new Logger(logger);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
guschmue
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add support for
LoggingManager::HasDefaultLogger().