53 namespace onnxruntime {
57 using Timestamp = std::chrono::time_point<std::chrono::system_clock>;
62 constexpr
bool vlog_enabled =
false;
110 int default_max_vlog_level = -1);
128 Severity min_severity,
bool filter_user_data,
int max_vlog_level = -1);
168 const char* format_str, ...);
188 void CreateDefaultLogger(
const std::
string& logger_id);
190 std::unique_ptr<
ISink> sink_;
192 const bool default_filter_user_data_;
193 const int default_max_vlog_level_;
194 bool owns_default_logger_;
196 static
Logger* s_default_logger_;
199 const std::chrono::time_point<std::chrono::high_resolution_clock> high_res;
200 const std::chrono::time_point<std::chrono::system_clock> system;
201 const std::chrono::minutes localtime_offset_from_utc;
204 static const Epochs& GetEpochs() noexcept;
223 : logging_manager_{&loggingManager},
226 filter_user_data_{filter_user_data},
227 max_vlog_level_{vlog_level} {
248 void SetVerbosity(
int vlog_level) noexcept { max_vlog_level_ = vlog_level; }
272 logging_manager_->Log(id_, message);
280 logging_manager_->SendProfileEvent(eventRecord);
287 const bool filter_user_data_;
292 if (s_default_logger_ ==
nullptr) {
294 ORT_THROW(
"Attempt to use DefaultLogger but none has been registered.");
297 return *s_default_logger_;
301 if (s_default_logger_ ==
nullptr) {
303 ORT_THROW(
"Attempt to use DefaultLogger but none has been registered.");
310 if (s_default_logger_ ==
nullptr) {
312 ORT_THROW(
"Attempt to use DefaultLogger but none has been registered.");
319 static const Epochs& epochs = GetEpochs();
321 const auto high_res_now = std::chrono::high_resolution_clock::now();
322 return std::chrono::time_point_cast<std::chrono::system_clock::duration>(
323 epochs.system + (high_res_now - epochs.high_res) + epochs.localtime_offset_from_utc);
Logger(const LoggingManager &loggingManager, std::string id, Severity severity, bool filter_user_data, int vlog_level)
GLuint GLsizei const GLchar * message
void Log(const std::string &logger_id, const Capture &message) const
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
std::unique_ptr< Logger > CreateLogger(const std::string &logger_id)
GLsizei const GLchar *const * string
void SendProfileEvent(profiling::EventRecord &eventRecord) const
LoggingManager(std::unique_ptr< ISink > sink, Severity default_min_severity, bool default_filter_user_data, InstanceType instance_type, const std::string *default_logger_id=nullptr, int default_max_vlog_level=-1)
void SendProfileEvent(profiling::EventRecord &eventRecord) const
static void SetDefaultLoggerSeverity(Severity severity)
Contains potentially sensitive user data.
unsigned int GetThreadId()
Temporal instance. CreateLogger(...) should be used, however DefaultLogger() will NOT be provided via...
unsigned int GetProcessId()
static const Logger & DefaultLogger()
static const char * onnxruntime
General output.
The logging manager. Owns the log sink and potentially provides a default Logger instance. Provides filtering based on a minimum LogSeverity level, and of messages with DataType::User if enabled.
std::chrono::time_point< std::chrono::system_clock > Timestamp
void SetVerbosity(int vlog_level) noexcept
#define ORT_ATTRIBUTE_UNUSED
static void SetDefaultLoggerVerbosity(int vlog_level)
Severity GetSeverity() const noexcept
void SetSeverity(Severity severity) noexcept
bool OutputIsEnabled(Severity severity, DataType data_type) const noexcept
void Log(const Capture &message) const
static bool HasDefaultLogger()
static const char * System
Log output regarding interactions with the host system.
int VLOGMaxLevel() const noexcept
static std::exception LogFatalAndCreateException(const char *category, const CodeLocation &location, const char *format_str,...)
Default instance of LoggingManager that should exist for the lifetime of the program.