1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 18 #include "binder_printing.h" 19 20 #include <android-base/logging.h> 21 22 namespace android::hardware::radio::minimal::debug { 23 24 static constexpr bool kSuperVerbose = true; 25 static constexpr bool kSuperCrazyVerbose = false; 26 27 // clang-format off 28 #define LOG_CALL_ALWAYS \ 29 LOG(VERBOSE) << '[' << serial << ("] " RADIO_MODULE ".") << __func__ << ' ' 30 31 #define LOG_CALL \ 32 if constexpr (::android::hardware::radio::minimal::debug::kSuperVerbose) \ 33 LOG_CALL_ALWAYS 34 35 #define LOG_CALL_RESPONSE \ 36 if constexpr (::android::hardware::radio::minimal::debug::kSuperCrazyVerbose) \ 37 LOG(VERBOSE) << '[' << info.serial << ("] " RADIO_MODULE ".") << __func__ << ' ' 38 39 #define LOG_CALL_NOSERIAL \ 40 if constexpr (::android::hardware::radio::minimal::debug::kSuperVerbose) \ 41 LOG(VERBOSE) << (RADIO_MODULE ".") << __func__ << ' ' 42 // clang-format on 43 44 /** 45 * Logs calls implemented to pretend doing the right thing, but doing nothing instead. 46 */ 47 #define LOG_CALL_IGNORED LOG_CALL_ALWAYS << "(ignored) " 48 49 /** 50 * Logs calls always responding with REQUEST_NOT_SUPPORTED error. 51 */ 52 #define LOG_NOT_SUPPORTED LOG_CALL_ALWAYS << "(not supported) " 53 54 /** 55 * Logs calls to deprecated methods. They should be never called by the framework nor xTS. 56 */ 57 #define LOG_AND_RETURN_DEPRECATED() \ 58 LOG(ERROR) << '[' << serial << ("] " RADIO_MODULE ".") << __func__ << " (deprecated!) "; \ 59 return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION) 60 61 } // namespace android::hardware::radio::minimal::debug 62