Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log

The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.

Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`

Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.

For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
Théo Battrel 2022-11-02 14:31:13 +01:00 committed by Carles Cufí
commit e458f5aae6
253 changed files with 7131 additions and 7180 deletions

View file

@ -11,11 +11,9 @@
#include <zephyr/net/buf.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/mesh.h>
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_MESH_DEBUG_ADV)
#define LOG_MODULE_NAME bt_mesh_adv_ext
#include "common/log.h"
#include "common/bt_str.h"
#include "host/hci_core.h"
@ -24,6 +22,10 @@
#include "net.h"
#include "proxy.h"
#define LOG_LEVEL CONFIG_BT_MESH_ADV_LOG_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_mesh_adv_ext);
/* Convert from ms to 0.625ms units */
#define ADV_INT_FAST_MS 20
@ -126,19 +128,19 @@ static int adv_start(struct bt_mesh_ext_adv *adv,
int err;
if (!adv->instance) {
BT_ERR("Mesh advertiser not enabled");
LOG_ERR("Mesh advertiser not enabled");
return -ENODEV;
}
if (atomic_test_and_set_bit(adv->flags, ADV_FLAG_ACTIVE)) {
BT_ERR("Advertiser is busy");
LOG_ERR("Advertiser is busy");
return -EBUSY;
}
if (atomic_test_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS)) {
err = bt_le_ext_adv_update_param(adv->instance, param);
if (err) {
BT_ERR("Failed updating adv params: %d", err);
LOG_ERR("Failed updating adv params: %d", err);
atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE);
return err;
}
@ -149,7 +151,7 @@ static int adv_start(struct bt_mesh_ext_adv *adv,
err = bt_le_ext_adv_set_data(adv->instance, ad, ad_len, sd, sd_len);
if (err) {
BT_ERR("Failed setting adv data: %d", err);
LOG_ERR("Failed setting adv data: %d", err);
atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE);
return err;
}
@ -158,7 +160,7 @@ static int adv_start(struct bt_mesh_ext_adv *adv,
err = bt_le_ext_adv_start(adv->instance, start);
if (err) {
BT_ERR("Advertising failed: err %d", err);
LOG_ERR("Advertising failed: err %d", err);
atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE);
}
@ -180,11 +182,10 @@ static int buf_send(struct bt_mesh_ext_adv *adv, struct net_buf *buf)
/* Upper boundary estimate: */
duration = start.num_events * (adv_int + 10);
BT_DBG("type %u len %u: %s", BT_MESH_ADV(buf)->type,
buf->len, bt_hex(buf->data, buf->len));
BT_DBG("count %u interval %ums duration %ums",
BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1, adv_int,
duration);
LOG_DBG("type %u len %u: %s", BT_MESH_ADV(buf)->type, buf->len,
bt_hex(buf->data, buf->len));
LOG_DBG("count %u interval %ums duration %ums",
BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1, adv_int, duration);
ad.type = bt_mesh_adv_type[BT_MESH_ADV(buf)->type];
ad.data_len = buf->len;
@ -222,7 +223,7 @@ static void send_pending_adv(struct k_work *work)
*/
int64_t duration = k_uptime_delta(&adv->timestamp);
BT_DBG("Advertising stopped after %u ms", (uint32_t)duration);
LOG_DBG("Advertising stopped after %u ms", (uint32_t)duration);
atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE);
atomic_clear_bit(adv->flags, ADV_FLAG_PROXY);
@ -364,7 +365,7 @@ static void adv_sent(struct bt_le_ext_adv *instance,
struct bt_mesh_ext_adv *adv = adv_instance_find(instance);
if (!adv) {
BT_WARN("Unexpected adv instance");
LOG_WRN("Unexpected adv instance");
return;
}
@ -429,7 +430,7 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param,
.timeout = (duration == SYS_FOREVER_MS) ? 0 : MAX(1, duration / 10),
};
BT_DBG("Start advertising %d ms", duration);
LOG_DBG("Start advertising %d ms", duration);
atomic_set_bit(adv->flags, ADV_FLAG_UPDATE_PARAMS);