2 * Copyright (c) 2020 Project CHIP Authors.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * This header redirects Pigweed logging prints to chip.
23 #include <support/logging/CHIPLogging.h>
25 #include "pw_preprocessor/arguments.h"
28 * Redirect pigweed log prints to chip logging.
29 * Currently does not use a log module, but this could be added when needed.
30 * pigweed debug and info level logs are mapped to chip's kLogCategory_Detail.
31 * All other log levels are mapped to chip's kLogCategory_Error.
33 * Note: This function should not be called directly, instead call the functions
36 * @param[in] level Pigweed log level.
37 * @param[in] flags Pigweed logging flags, currently these are ignored.
38 * @param[in] message The printf style log string.
40 #define PW_LOG(level, flags, message, ...) \
43 if (level >= PW_LOG_LEVEL_INFO) \
45 ::chip::Logging::Log(::chip::Logging::kLogModule_NotSpecified, \
46 (level <= PW_LOG_LEVEL_INFO) ? ::chip::Logging::kLogCategory_Detail \
47 : ::chip::Logging::kLogCategory_Error, \
48 message PW_COMMA_ARGS(__VA_ARGS__)); \