This class represents an ONNX Runtime logger that can be used to log information with an associated severity level and source code location (file path, line number, function name).
More...
#include <onnxruntime_cxx_api.h>
This class represents an ONNX Runtime logger that can be used to log information with an associated severity level and source code location (file path, line number, function name).
A Logger can be obtained from within custom operators by calling Ort::KernelInfo::GetLogger(). Instances of Ort::Logger are the size of two pointers and can be passed by value.
Use the ORT_CXX_LOG macros to ensure the source code location is set properly from the callsite and to take advantage of a cached logging severity level that can bypass calls to the underlying C API.
Definition at line 1973 of file onnxruntime_cxx_api.h.
Ort::Logger::Logger |
( |
std::nullptr_t |
| ) |
|
|
inlineexplicit |
Ort::Logger::Logger |
( |
const OrtLogger * |
logger | ) |
|
|
inlineexplicit |
Creates a logger from an ::OrtLogger instance. Caches the logger's current severity level by calling OrtApi::Logger_GetLoggingSeverityLevel. Throws an exception if OrtApi::Logger_GetLoggingSeverityLevel fails.
- Parameters
-
logger | The ::OrtLogger to wrap. |
Definition at line 1564 of file onnxruntime_cxx_inline.h.
Ort::Logger::Logger |
( |
const Logger & |
| ) |
|
|
default |
Ort::Logger::Logger |
( |
Logger && |
v | ) |
|
|
defaultnoexcept |
OrtLoggingLevel Ort::Logger::GetLoggingSeverityLevel |
( |
| ) |
const |
|
inlinenoexcept |
Returns the logger's current severity level from the cached member.
- Returns
- The current ::OrtLoggingLevel.
Definition at line 1568 of file onnxruntime_cxx_inline.h.
template<typename... Args>
Status Ort::Logger::LogFormattedMessage |
( |
OrtLoggingLevel |
log_severity_level, |
|
|
const ORTCHAR_T * |
file_path, |
|
|
int |
line_number, |
|
|
const char * |
func_name, |
|
|
const char * |
format, |
|
|
Args &&... |
args |
|
) |
| const |
|
inlinenoexcept |
Logs a printf-like formatted message via OrtApi::Logger_LogMessage. Use the ORT_CXX_LOGF or ORT_CXX_LOGF_NOEXCEPT macros to properly set the source code location and to use the cached severity level to potentially bypass calls to the underlying C API. Returns an error status if a formatting error occurs.
- Parameters
-
log_severity_level | The message's logging severity level. |
file_path | The filepath of the file in which the message is logged. Usually the value of ORT_FILE. |
line_number | The file line number in which the message is logged. Usually the value of LINE. |
func_name | The name of the function in which the message is logged. Usually the value of FUNCTION. |
format | A null-terminated UTF-8 format string forwarded to a printf-like function. Refer to https://en.cppreference.com/w/cpp/io/c/fprintf for information on valid formats. |
args | Zero or more variadic arguments referenced by the format string. |
- Returns
- A Ort::Status value to indicate error or success.
Definition at line 1592 of file onnxruntime_cxx_inline.h.
Status Ort::Logger::LogMessage |
( |
OrtLoggingLevel |
log_severity_level, |
|
|
const ORTCHAR_T * |
file_path, |
|
|
int |
line_number, |
|
|
const char * |
func_name, |
|
|
const char * |
message |
|
) |
| const |
|
inlinenoexcept |
Logs the provided message via OrtApi::Logger_LogMessage. Use the ORT_CXX_LOG or ORT_CXX_LOG_NOEXCEPT macros to properly set the source code location and to use the cached severity level to potentially bypass calls to the underlying C API.
- Parameters
-
log_severity_level | The message's logging severity level. |
file_path | The filepath of the file in which the message is logged. Usually the value of ORT_FILE. |
line_number | The file line number in which the message is logged. Usually the value of LINE. |
func_name | The name of the function in which the message is logged. Usually the value of FUNCTION. |
message | The message to log. |
- Returns
- A Ort::Status value to indicate error or success.
Definition at line 1572 of file onnxruntime_cxx_inline.h.
The documentation for this struct was generated from the following files: