1 // Copyright 2024 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #pragma once 16 17 #include <zephyr/sys/__assert.h> 18 19 // If static_assert wasn't defined by zephyr/sys/__assert.h that means it's not 20 // supported, just ignore it. 21 #ifndef static_assert 22 #define static_assert(...) 23 #endif 24 25 #include <pw_log/log.h> 26 27 #undef shell_fprintf 28 #undef shell_info 29 #undef shell_print 30 #undef shell_warn 31 #undef shell_error 32 33 #define shell_fprintf(sh, color, fmt, ...) \ 34 do { \ 35 (void)(sh); \ 36 (void)(color); \ 37 PW_LOG_INFO(fmt, ##__VA_ARGS__); \ 38 } while (0) 39 40 #define shell_info(_sh, _ft, ...) \ 41 do { \ 42 (void)(_sh); \ 43 PW_LOG_INFO(_ft, ##__VA_ARGS__); \ 44 } while (0) 45 46 #define shell_print(_sh, _ft, ...) \ 47 do { \ 48 (void)(_sh); \ 49 PW_LOG_INFO(_ft, ##__VA_ARGS__); \ 50 } while (0) 51 52 #define shell_warn(_sh, _ft, ...) \ 53 do { \ 54 (void)(_sh); \ 55 PW_LOG_WARN(_ft, ##__VA_ARGS__); \ 56 } while (0) 57 58 #define shell_error(_sh, _ft, ...) \ 59 do { \ 60 (void)(_sh); \ 61 PW_LOG_ERROR(_ft, ##__VA_ARGS__); \ 62 } while (0) 63