xref: /aosp_15_r20/external/executorch/backends/qualcomm/runtime/Logging.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Qualcomm Innovation Center, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 #pragma once
9 
10 #include <executorch/backends/qualcomm/qc_compiler_spec_generated.h>
11 #include <executorch/runtime/core/error.h>
12 namespace executorch {
13 namespace backends {
14 namespace qnn {
15 using namespace qnn_delegate;
16 
17 void Log(QnnExecuTorchLogLevel log_level, const char* format, ...);
18 
19 #define QNN_EXECUTORCH_LOG(log_level, format, ...) \
20   do {                                             \
21     Log(log_level, format, ##__VA_ARGS__);         \
22   } while (false);
23 
24 #define QNN_EXECUTORCH_LOG_ERROR(fmt, ...) \
25   QNN_EXECUTORCH_LOG(QnnExecuTorchLogLevel::kLogLevelError, fmt, ##__VA_ARGS__)
26 #define QNN_EXECUTORCH_LOG_WARN(fmt, ...) \
27   QNN_EXECUTORCH_LOG(QnnExecuTorchLogLevel::kLogLevelWarn, fmt, ##__VA_ARGS__)
28 #define QNN_EXECUTORCH_LOG_INFO(fmt, ...) \
29   QNN_EXECUTORCH_LOG(QnnExecuTorchLogLevel::kLogLevelInfo, fmt, ##__VA_ARGS__)
30 #define QNN_EXECUTORCH_LOG_VERBBOSE(fmt, ...) \
31   QNN_EXECUTORCH_LOG(                         \
32       QnnExecuTorchLogLevel::kLogLevelVerbose, fmt, ##__VA_ARGS__)
33 #define QNN_EXECUTORCH_LOG_DEBUG(fmt, ...) \
34   QNN_EXECUTORCH_LOG(QnnExecuTorchLogLevel::kLogLevelDebug, fmt, ##__VA_ARGS__)
35 } // namespace qnn
36 } // namespace backends
37 } // namespace executorch
38