2015-07-02 04:47:13 +08:00
|
|
|
/** @file
|
2015-06-16 22:25:37 +08:00
|
|
|
* @brief Bluetooth subsystem logging helpers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-06-16 22:25:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-06-16 22:25:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-06-16 22:25:37 +08:00
|
|
|
*/
|
|
|
|
#ifndef __BT_LOG_H
|
|
|
|
#define __BT_LOG_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-12-08 18:17:31 +08:00
|
|
|
#if defined(CONFIG_BLUETOOTH_DEBUG_COLOR)
|
|
|
|
#define BT_COLOR_OFF "\x1B[0m"
|
|
|
|
#define BT_COLOR_RED "\x1B[0;31m"
|
|
|
|
#define BT_COLOR_YELLOW "\x1B[0;33m"
|
|
|
|
#else
|
|
|
|
#define BT_COLOR_OFF ""
|
|
|
|
#define BT_COLOR_RED ""
|
|
|
|
#define BT_COLOR_YELLOW ""
|
|
|
|
#endif
|
|
|
|
|
2015-06-16 22:25:37 +08:00
|
|
|
#if defined(CONFIG_BLUETOOTH_DEBUG)
|
2015-11-25 21:26:48 +08:00
|
|
|
#define BT_DBG(fmt, ...) printf("bt: %s (%p): " fmt "\n", __func__, \
|
2015-08-20 23:04:01 +08:00
|
|
|
sys_thread_self_get(), ##__VA_ARGS__)
|
2015-12-08 18:17:31 +08:00
|
|
|
#define BT_ERR(fmt, ...) printf("bt: %s: %s" fmt "%s\n", __func__, \
|
|
|
|
BT_COLOR_RED, ##__VA_ARGS__, BT_COLOR_OFF)
|
|
|
|
#define BT_WARN(fmt, ...) printf("bt: %s: %s" fmt "%s\n", __func__, \
|
|
|
|
BT_COLOR_YELLOW, ##__VA_ARGS__, BT_COLOR_OFF)
|
2015-11-25 21:26:48 +08:00
|
|
|
#define BT_INFO(fmt, ...) printf("bt: " fmt "\n", ##__VA_ARGS__)
|
2015-07-07 17:07:50 +08:00
|
|
|
#define BT_ASSERT(cond) if (!(cond)) { \
|
2015-12-08 18:19:52 +08:00
|
|
|
BT_ERR("assert: '" #cond "' failed"); \
|
2015-07-07 17:07:50 +08:00
|
|
|
}
|
2015-06-16 22:25:37 +08:00
|
|
|
#else
|
|
|
|
#define BT_DBG(fmt, ...)
|
|
|
|
#define BT_ERR(fmt, ...)
|
|
|
|
#define BT_WARN(fmt, ...)
|
|
|
|
#define BT_INFO(fmt, ...)
|
2015-07-07 17:07:50 +08:00
|
|
|
#define BT_ASSERT(cond)
|
2015-06-16 22:25:37 +08:00
|
|
|
#endif /* CONFIG_BLUETOOTH_DEBUG */
|
|
|
|
|
|
|
|
#endif /* __BT_LOG_H */
|