OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[Docs] Show log callback usage in samples (#31973)
Tomasz Jankowskia440606bcd4c
diff --git a/docs/articles_en/get-started/learn-openvino/openvino-samples/hello-classification.rst b/docs/articles_en/get-started/learn-openvino/openvino-samples/hello-classification.rstindex 85df253a549..3bd11cf883d 100644--- a/docs/articles_en/get-started/learn-openvino/openvino-samples/hello-classification.rst+++ b/docs/articles_en/get-started/learn-openvino/openvino-samples/hello-classification.rst@@ -18,8 +18,8 @@ Synchronous Inference Request API. Before using the sample, refer to the followiHow It Works####################-At startup, the sample application reads command-line parameters, prepares input data,-loads a specified model and image to the OpenVINO™ Runtime plugin, performs synchronous+At startup, the sample application sets log message capturing callback and reads command-line parameters.+Then it prepares input data, loads a specified model and image to the OpenVINO™ Runtime plugin, performs synchronousinference, and processes output data, logging each step in a standard output stream... tab-set::diff --git a/samples/cpp/hello_classification/main.cpp b/samples/cpp/hello_classification/main.cppindex 7672f4aaf34..6e6292eebe0 100644--- a/samples/cpp/hello_classification/main.cpp+++ b/samples/cpp/hello_classification/main.cpp@@ -23,6 +23,12 @@*/int tmain(int argc, tchar* argv[]) {try {+ // -------- Set OpenVINO log message capturing callback --------+ const std::function<void(std::string_view)> log_callback{[](std::string_view msg) {+ slog::info << msg;+ }};+ ov::util::set_log_callback(log_callback);+// -------- Get OpenVINO runtime version --------slog::info << ov::get_openvino_version() << slog::endl;diff --git a/src/core/include/openvino/core/core.hpp b/src/core/include/openvino/core/core.hppindex 816abd99291..183df7bc2da 100644--- a/src/core/include/openvino/core/core.hpp+++ b/src/core/include/openvino/core/core.hpp@@ -20,6 +20,7 @@#include "openvino/core/graph_util.hpp"#include "openvino/core/interval.hpp"#include "openvino/core/layout.hpp"+#include "openvino/core/log.hpp"#include "openvino/core/model.hpp"#include "openvino/core/node.hpp"#include "openvino/core/node_input.hpp"