Skip to content

[EP Plugin Adapter] support LoggingManager::HasDefaultLogger()#27587

Merged
fs-eire merged 1 commit intomainfrom
fs-eire/logging-manager
Mar 11, 2026
Merged

[EP Plugin Adapter] support LoggingManager::HasDefaultLogger()#27587
fs-eire merged 1 commit intomainfrom
fs-eire/logging-manager

Conversation

@fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Mar 8, 2026

Description

Add support for LoggingManager::HasDefaultLogger().

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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::LoggingManager with HasDefaultLogger() and move default-logger management off Logger.
  • Update the adapter’s LOGS_DEFAULT_CATEGORY macro to use LoggingManager::DefaultLogger().
  • Expose LoggingManager via EP-specific using declarations in include/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() dereferences instance_ without checking it is initialized, which is undefined behavior if logging is used before CreateDefaultLogger() is called. Also, CreateDefaultLogger() overwrites instance_ without deleting/guarding against an existing logger, which can leak if called more than once. Consider matching ::onnxruntime::logging::LoggingManager behavior: throw (or otherwise fail fast) if instance_ is null in DefaultLogger(), and either throw if instance_ is already set or delete/require DestroyDefaultLogger() 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.

@fs-eire fs-eire merged commit c07ece3 into main Mar 11, 2026
101 of 103 checks passed
@fs-eire fs-eire deleted the fs-eire/logging-manager branch March 11, 2026 16:41
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