mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-08 02:57:56 +00:00
porting: Remove dependency on Mynewt logging system
Define NPL interface that can be used by ports to implement logging.
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
|
||||
#include <assert.h>
|
||||
#include "os/mynewt.h"
|
||||
#include "mesh/mesh.h"
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
#ifndef H_BLE_HS_LOG_
|
||||
#define H_BLE_HS_LOG_
|
||||
|
||||
#ifndef BLE_NPL_LOG_MODULE
|
||||
#define BLE_NPL_LOG_MODULE BLE_HS_LOG
|
||||
#endif
|
||||
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
/**
|
||||
* @file ble_hs_log.h
|
||||
*
|
||||
@@ -33,14 +39,6 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "modlog/modlog.h"
|
||||
#include "log/log.h"
|
||||
|
||||
/* Only include the logcfg header if this version of newt can generate it. */
|
||||
#if MYNEWT_VAL(NEWT_FEATURE_LOGCFG)
|
||||
#include "logcfg/logcfg.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -57,7 +55,7 @@ struct os_mbuf;
|
||||
* @param ... The format string and additional arguments for the log message.
|
||||
*/
|
||||
#define BLE_HS_LOG(lvl, ...) \
|
||||
BLE_HS_LOG_ ## lvl(__VA_ARGS__)
|
||||
BLE_NPL_LOG(lvl, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a Bluetooth address at a specified log level.
|
||||
@@ -69,9 +67,9 @@ struct os_mbuf;
|
||||
* @param addr The Bluetooth address to be logged.
|
||||
*/
|
||||
#define BLE_HS_LOG_ADDR(lvl, addr) \
|
||||
BLE_HS_LOG_ ## lvl("%02x:%02x:%02x:%02x:%02x:%02x", \
|
||||
(addr)[5], (addr)[4], (addr)[3], \
|
||||
(addr)[2], (addr)[1], (addr)[0])
|
||||
BLE_NPL_LOG(lvl, "%02x:%02x:%02x:%02x:%02x:%02x", \
|
||||
(addr)[5], (addr)[4], (addr)[3], \
|
||||
(addr)[2], (addr)[1], (addr)[0])
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#include "logcfg/logcfg.h"
|
||||
#include "modlog/modlog.h"
|
||||
#include "nimble/nimble_npl.h"
|
||||
|
||||
#include "os/os_mbuf.h"
|
||||
@@ -182,19 +180,10 @@ extern "C" {
|
||||
#define BT_GAP_ADV_SLOW_INT_MIN 0x0640 /* 1 s */
|
||||
#define BT_GAP_ADV_SLOW_INT_MAX 0x0780 /* 1.2 s */
|
||||
|
||||
#ifndef MESH_LOG_MODULE
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
#endif
|
||||
|
||||
#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__)
|
||||
#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
|
||||
|
||||
#define BLE_MESH_LOG(lvl, ...) CAT(MESH_LOG_MODULE, CAT(_, lvl))(__VA_ARGS__)
|
||||
|
||||
#define BT_DBG(fmt, ...) BLE_MESH_LOG(DEBUG, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_INFO(fmt, ...) BLE_MESH_LOG(INFO, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_WARN(fmt, ...) BLE_MESH_LOG(WARN, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_ERR(fmt, ...) BLE_MESH_LOG(ERROR, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_DBG(fmt, ...) BLE_NPL_LOG(DEBUG, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_INFO(fmt, ...) BLE_NPL_LOG(INFO, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_WARN(fmt, ...) BLE_NPL_LOG(WARN, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_ERR(fmt, ...) BLE_NPL_LOG(ERROR, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
|
||||
#define BT_GATT_ERR(_att_err) (-(_att_err))
|
||||
|
||||
typedef ble_addr_t bt_addr_le_t;
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_ACCESS_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_ACCESS_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_ADV_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_ADV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh/mesh.h"
|
||||
#include "host/ble_hs_adv.h"
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_ADV_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_ADV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "adv.h"
|
||||
#include "net.h"
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_ADV_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_ADV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "adv.h"
|
||||
#include "net.h"
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "crypto.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
|
||||
static inline void xor16(uint8_t *dst, const uint8_t *a, const uint8_t *b)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "mesh/mesh.h"
|
||||
@@ -21,10 +24,6 @@
|
||||
#include "access.h"
|
||||
#include "subnet.h"
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
|
||||
#include "log/log.h"
|
||||
|
||||
/* Tracking of what storage changes are pending for App Keys. We track this in
|
||||
* a separate array here instead of within the respective bt_mesh_app_key
|
||||
* struct itselve, since once a key gets deleted its struct becomes invalid
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_BEACON_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_BEACON_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
#include "log/log.h"
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cdb_priv.h"
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh/mesh.h"
|
||||
#include "mesh_priv.h"
|
||||
#include "net.h"
|
||||
@@ -15,9 +18,6 @@
|
||||
#include "cfg.h"
|
||||
#include "mesh/glue.h"
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
#include "log/log.h"
|
||||
|
||||
/* Miscellaneous configuration server model states */
|
||||
struct cfg_val {
|
||||
uint8_t net_transmit;
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#if MYNEWT_VAL(BLE_MESH_CFG_CLI)
|
||||
|
||||
#include "mesh/mesh.h"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_CRYPTO_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_CRYPTO_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_FRIEND_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_FRIEND_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
|
||||
#if MYNEWT_VAL(BLE_MESH_FRIEND)
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh/glue.h"
|
||||
#include "adv.h"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_HEARTBEAT_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_HEARTBEAT_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh_priv.h"
|
||||
#include "net.h"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOW_POWER_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOW_POWER_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#if MYNEWT_VAL(BLE_MESH_LOW_POWER)
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh/mesh.h"
|
||||
#include "mesh/model_cli.h"
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_MODEL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
|
||||
#include "mesh/mesh.h"
|
||||
#include "mesh/model_srv.h"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_NET_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_NET_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh/mesh.h"
|
||||
#include "prov.h"
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh_priv.h"
|
||||
#include "adv.h"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "testing.h"
|
||||
#include "crypto.h"
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROV_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "testing.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROXY_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROXY_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#if MYNEWT_VAL(BLE_MESH_PROXY)
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_PROXY_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_PROXY_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "mesh/slist.h"
|
||||
#include "mesh/mesh.h"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define MESH_LOG_MODULE BLE_MESH_RPL_LOG
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_RPL_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "log/log.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mesh_priv.h"
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_SETTINGS_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_SETTINGS_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#if MYNEWT_VAL(BLE_MESH_SETTINGS)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_NET_KEYS_LOG
|
||||
|
||||
#include "log/log.h"
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_NET_KEYS_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include "crypto.h"
|
||||
#include "adv.h"
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define MESH_LOG_MODULE BLE_MESH_TRANS_LOG
|
||||
|
||||
#define BLE_NPL_LOG_MODULE BLE_MESH_TRANS_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#include <syscfg/syscfg.h>
|
||||
#define BLE_NPL_LOG_MODULE BLE_EATT_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include "os/os.h"
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
#define BLE_NPL_LOG_MODULE BLE_EATT_LOG
|
||||
#include <nimble/nimble_npl_log.h>
|
||||
|
||||
#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include "host/ble_hs.h"
|
||||
#include "host/ble_hs_log.h"
|
||||
|
||||
struct log ble_hs_log;
|
||||
|
||||
void
|
||||
ble_hs_log_mbuf(const struct os_mbuf *om)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NIMBLE_NPL_LOG_H_
|
||||
#define _NIMBLE_NPL_LOG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef BLE_NPL_LOG_MODULE
|
||||
#error "NPL Logging module not specified"
|
||||
#endif
|
||||
|
||||
/* helper macros */
|
||||
#define _BLE_NPL_LOG_CAT(a, ...) _BLE_NPL_LOG_PRIMITIVE_CAT(a, __VA_ARGS__)
|
||||
#define _BLE_NPL_LOG_PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
|
||||
|
||||
/* used to generate proper log function call (used by stack) */
|
||||
#define BLE_NPL_LOG(lvl, ...) _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, _BLE_NPL_LOG_CAT(_, lvl))(__VA_ARGS__)
|
||||
|
||||
/* Include OS-specific LOG implementation, should provide implementation for
|
||||
* logging macros used by NiBLE (eg via modlog) or BLE_NPL_LOG_IMPL
|
||||
* macro implementation that generates required logging functions/macros
|
||||
*/
|
||||
#include "nimble/nimble_npl_os_log.h"
|
||||
|
||||
/* generate logging functions for modules, can be macro or function */
|
||||
#ifdef BLE_NPL_LOG_IMPL
|
||||
BLE_NPL_LOG_IMPL(DEBUG);
|
||||
BLE_NPL_LOG_IMPL(INFO);
|
||||
BLE_NPL_LOG_IMPL(WARN);
|
||||
BLE_NPL_LOG_IMPL(ERROR);
|
||||
BLE_NPL_LOG_IMPL(CRITICAL);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NIMBLE_NPL_LOG_H_ */
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.11.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_LOGCFG_
|
||||
#define H_MYNEWT_LOGCFG_
|
||||
|
||||
#include "modlog/modlog.h"
|
||||
#include "log_common/log_common.h"
|
||||
|
||||
#define BLE_EATT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_EATT_LOG_INFO(...) MODLOG_INFO(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_WARN(...) MODLOG_WARN(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_ERROR(...) MODLOG_ERROR(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_CRITICAL(...) MODLOG_CRITICAL(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_DISABLED(...) MODLOG_DISABLED(22, __VA_ARGS__)
|
||||
|
||||
#define BLE_HS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_HS_LOG_INFO(...) MODLOG_INFO(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_WARN(...) MODLOG_WARN(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_ERROR(...) MODLOG_ERROR(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_CRITICAL(...) MODLOG_CRITICAL(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_DISABLED(...) MODLOG_DISABLED(4, __VA_ARGS__)
|
||||
|
||||
#define DFLT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define DFLT_LOG_INFO(...) MODLOG_INFO(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_WARN(...) MODLOG_WARN(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_ERROR(...) MODLOG_ERROR(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_CRITICAL(...) MODLOG_CRITICAL(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_DISABLED(...) MODLOG_DISABLED(0, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -1,158 +0,0 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.11.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_LOGCFG_
|
||||
#define H_MYNEWT_LOGCFG_
|
||||
|
||||
#include "modlog/modlog.h"
|
||||
#include "log_common/log_common.h"
|
||||
|
||||
#define BLE_EATT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_EATT_LOG_INFO(...) MODLOG_INFO(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_WARN(...) MODLOG_WARN(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_ERROR(...) MODLOG_ERROR(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_CRITICAL(...) MODLOG_CRITICAL(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_DISABLED(...) MODLOG_DISABLED(22, __VA_ARGS__)
|
||||
|
||||
#define BLE_HS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_HS_LOG_INFO(...) MODLOG_INFO(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_WARN(...) MODLOG_WARN(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_ERROR(...) MODLOG_ERROR(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_CRITICAL(...) MODLOG_CRITICAL(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_DISABLED(...) MODLOG_DISABLED(4, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_ACCESS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_ACCESS_LOG_INFO(...) MODLOG_INFO(10, __VA_ARGS__)
|
||||
#define BLE_MESH_ACCESS_LOG_WARN(...) MODLOG_WARN(10, __VA_ARGS__)
|
||||
#define BLE_MESH_ACCESS_LOG_ERROR(...) MODLOG_ERROR(10, __VA_ARGS__)
|
||||
#define BLE_MESH_ACCESS_LOG_CRITICAL(...) MODLOG_CRITICAL(10, __VA_ARGS__)
|
||||
#define BLE_MESH_ACCESS_LOG_DISABLED(...) MODLOG_DISABLED(10, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_ADV_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_ADV_LOG_INFO(...) MODLOG_INFO(11, __VA_ARGS__)
|
||||
#define BLE_MESH_ADV_LOG_WARN(...) MODLOG_WARN(11, __VA_ARGS__)
|
||||
#define BLE_MESH_ADV_LOG_ERROR(...) MODLOG_ERROR(11, __VA_ARGS__)
|
||||
#define BLE_MESH_ADV_LOG_CRITICAL(...) MODLOG_CRITICAL(11, __VA_ARGS__)
|
||||
#define BLE_MESH_ADV_LOG_DISABLED(...) MODLOG_DISABLED(11, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_BEACON_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_BEACON_LOG_INFO(...) MODLOG_INFO(12, __VA_ARGS__)
|
||||
#define BLE_MESH_BEACON_LOG_WARN(...) MODLOG_WARN(12, __VA_ARGS__)
|
||||
#define BLE_MESH_BEACON_LOG_ERROR(...) MODLOG_ERROR(12, __VA_ARGS__)
|
||||
#define BLE_MESH_BEACON_LOG_CRITICAL(...) MODLOG_CRITICAL(12, __VA_ARGS__)
|
||||
#define BLE_MESH_BEACON_LOG_DISABLED(...) MODLOG_DISABLED(12, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_CRYPTO_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_CRYPTO_LOG_INFO(...) MODLOG_INFO(13, __VA_ARGS__)
|
||||
#define BLE_MESH_CRYPTO_LOG_WARN(...) MODLOG_WARN(13, __VA_ARGS__)
|
||||
#define BLE_MESH_CRYPTO_LOG_ERROR(...) MODLOG_ERROR(13, __VA_ARGS__)
|
||||
#define BLE_MESH_CRYPTO_LOG_CRITICAL(...) MODLOG_CRITICAL(13, __VA_ARGS__)
|
||||
#define BLE_MESH_CRYPTO_LOG_DISABLED(...) MODLOG_DISABLED(13, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_FRIEND_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_FRIEND_LOG_INFO(...) MODLOG_INFO(14, __VA_ARGS__)
|
||||
#define BLE_MESH_FRIEND_LOG_WARN(...) MODLOG_WARN(14, __VA_ARGS__)
|
||||
#define BLE_MESH_FRIEND_LOG_ERROR(...) MODLOG_ERROR(14, __VA_ARGS__)
|
||||
#define BLE_MESH_FRIEND_LOG_CRITICAL(...) MODLOG_CRITICAL(14, __VA_ARGS__)
|
||||
#define BLE_MESH_FRIEND_LOG_DISABLED(...) MODLOG_DISABLED(14, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_HEARTBEAT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_HEARTBEAT_LOG_INFO(...) MODLOG_INFO(26, __VA_ARGS__)
|
||||
#define BLE_MESH_HEARTBEAT_LOG_WARN(...) MODLOG_WARN(26, __VA_ARGS__)
|
||||
#define BLE_MESH_HEARTBEAT_LOG_ERROR(...) MODLOG_ERROR(26, __VA_ARGS__)
|
||||
#define BLE_MESH_HEARTBEAT_LOG_CRITICAL(...) MODLOG_CRITICAL(26, __VA_ARGS__)
|
||||
#define BLE_MESH_HEARTBEAT_LOG_DISABLED(...) MODLOG_DISABLED(26, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_LOG_INFO(...) MODLOG_INFO(9, __VA_ARGS__)
|
||||
#define BLE_MESH_LOG_WARN(...) MODLOG_WARN(9, __VA_ARGS__)
|
||||
#define BLE_MESH_LOG_ERROR(...) MODLOG_ERROR(9, __VA_ARGS__)
|
||||
#define BLE_MESH_LOG_CRITICAL(...) MODLOG_CRITICAL(9, __VA_ARGS__)
|
||||
#define BLE_MESH_LOG_DISABLED(...) MODLOG_DISABLED(9, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_LOW_POWER_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_LOW_POWER_LOG_INFO(...) MODLOG_INFO(15, __VA_ARGS__)
|
||||
#define BLE_MESH_LOW_POWER_LOG_WARN(...) MODLOG_WARN(15, __VA_ARGS__)
|
||||
#define BLE_MESH_LOW_POWER_LOG_ERROR(...) MODLOG_ERROR(15, __VA_ARGS__)
|
||||
#define BLE_MESH_LOW_POWER_LOG_CRITICAL(...) MODLOG_CRITICAL(15, __VA_ARGS__)
|
||||
#define BLE_MESH_LOW_POWER_LOG_DISABLED(...) MODLOG_DISABLED(15, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_MODEL_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_MODEL_LOG_INFO(...) MODLOG_INFO(16, __VA_ARGS__)
|
||||
#define BLE_MESH_MODEL_LOG_WARN(...) MODLOG_WARN(16, __VA_ARGS__)
|
||||
#define BLE_MESH_MODEL_LOG_ERROR(...) MODLOG_ERROR(16, __VA_ARGS__)
|
||||
#define BLE_MESH_MODEL_LOG_CRITICAL(...) MODLOG_CRITICAL(16, __VA_ARGS__)
|
||||
#define BLE_MESH_MODEL_LOG_DISABLED(...) MODLOG_DISABLED(16, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_NET_KEYS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_NET_KEYS_LOG_INFO(...) MODLOG_INFO(23, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_KEYS_LOG_WARN(...) MODLOG_WARN(23, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_KEYS_LOG_ERROR(...) MODLOG_ERROR(23, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_KEYS_LOG_CRITICAL(...) MODLOG_CRITICAL(23, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_KEYS_LOG_DISABLED(...) MODLOG_DISABLED(23, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_NET_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_NET_LOG_INFO(...) MODLOG_INFO(17, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_LOG_WARN(...) MODLOG_WARN(17, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_LOG_ERROR(...) MODLOG_ERROR(17, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_LOG_CRITICAL(...) MODLOG_CRITICAL(17, __VA_ARGS__)
|
||||
#define BLE_MESH_NET_LOG_DISABLED(...) MODLOG_DISABLED(17, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_PROVISIONER_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_PROVISIONER_LOG_INFO(...) MODLOG_INFO(25, __VA_ARGS__)
|
||||
#define BLE_MESH_PROVISIONER_LOG_WARN(...) MODLOG_WARN(25, __VA_ARGS__)
|
||||
#define BLE_MESH_PROVISIONER_LOG_ERROR(...) MODLOG_ERROR(25, __VA_ARGS__)
|
||||
#define BLE_MESH_PROVISIONER_LOG_CRITICAL(...) MODLOG_CRITICAL(25, __VA_ARGS__)
|
||||
#define BLE_MESH_PROVISIONER_LOG_DISABLED(...) MODLOG_DISABLED(25, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_PROV_DEVICE_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_PROV_DEVICE_LOG_INFO(...) MODLOG_INFO(24, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_DEVICE_LOG_WARN(...) MODLOG_WARN(24, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_DEVICE_LOG_ERROR(...) MODLOG_ERROR(24, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_DEVICE_LOG_CRITICAL(...) MODLOG_CRITICAL(24, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_DEVICE_LOG_DISABLED(...) MODLOG_DISABLED(24, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_PROV_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_PROV_LOG_INFO(...) MODLOG_INFO(18, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_LOG_WARN(...) MODLOG_WARN(18, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_LOG_ERROR(...) MODLOG_ERROR(18, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_LOG_CRITICAL(...) MODLOG_CRITICAL(18, __VA_ARGS__)
|
||||
#define BLE_MESH_PROV_LOG_DISABLED(...) MODLOG_DISABLED(18, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_PROXY_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_PROXY_LOG_INFO(...) MODLOG_INFO(19, __VA_ARGS__)
|
||||
#define BLE_MESH_PROXY_LOG_WARN(...) MODLOG_WARN(19, __VA_ARGS__)
|
||||
#define BLE_MESH_PROXY_LOG_ERROR(...) MODLOG_ERROR(19, __VA_ARGS__)
|
||||
#define BLE_MESH_PROXY_LOG_CRITICAL(...) MODLOG_CRITICAL(19, __VA_ARGS__)
|
||||
#define BLE_MESH_PROXY_LOG_DISABLED(...) MODLOG_DISABLED(19, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_RPL_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_RPL_LOG_INFO(...) MODLOG_INFO(22, __VA_ARGS__)
|
||||
#define BLE_MESH_RPL_LOG_WARN(...) MODLOG_WARN(22, __VA_ARGS__)
|
||||
#define BLE_MESH_RPL_LOG_ERROR(...) MODLOG_ERROR(22, __VA_ARGS__)
|
||||
#define BLE_MESH_RPL_LOG_CRITICAL(...) MODLOG_CRITICAL(22, __VA_ARGS__)
|
||||
#define BLE_MESH_RPL_LOG_DISABLED(...) MODLOG_DISABLED(22, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_SETTINGS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_SETTINGS_LOG_INFO(...) MODLOG_INFO(20, __VA_ARGS__)
|
||||
#define BLE_MESH_SETTINGS_LOG_WARN(...) MODLOG_WARN(20, __VA_ARGS__)
|
||||
#define BLE_MESH_SETTINGS_LOG_ERROR(...) MODLOG_ERROR(20, __VA_ARGS__)
|
||||
#define BLE_MESH_SETTINGS_LOG_CRITICAL(...) MODLOG_CRITICAL(20, __VA_ARGS__)
|
||||
#define BLE_MESH_SETTINGS_LOG_DISABLED(...) MODLOG_DISABLED(20, __VA_ARGS__)
|
||||
|
||||
#define BLE_MESH_TRANS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_MESH_TRANS_LOG_INFO(...) MODLOG_INFO(21, __VA_ARGS__)
|
||||
#define BLE_MESH_TRANS_LOG_WARN(...) MODLOG_WARN(21, __VA_ARGS__)
|
||||
#define BLE_MESH_TRANS_LOG_ERROR(...) MODLOG_ERROR(21, __VA_ARGS__)
|
||||
#define BLE_MESH_TRANS_LOG_CRITICAL(...) MODLOG_CRITICAL(21, __VA_ARGS__)
|
||||
#define BLE_MESH_TRANS_LOG_DISABLED(...) MODLOG_DISABLED(21, __VA_ARGS__)
|
||||
|
||||
#define DFLT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define DFLT_LOG_INFO(...) MODLOG_INFO(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_WARN(...) MODLOG_WARN(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_ERROR(...) MODLOG_ERROR(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_CRITICAL(...) MODLOG_CRITICAL(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_DISABLED(...) MODLOG_DISABLED(0, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.11.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_LOGCFG_
|
||||
#define H_MYNEWT_LOGCFG_
|
||||
|
||||
#include "modlog/modlog.h"
|
||||
#include "log_common/log_common.h"
|
||||
|
||||
#define BLE_HS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_HS_LOG_INFO(...) MODLOG_INFO(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_WARN(...) MODLOG_WARN(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_ERROR(...) MODLOG_ERROR(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_CRITICAL(...) MODLOG_CRITICAL(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_DISABLED(...) MODLOG_DISABLED(4, __VA_ARGS__)
|
||||
|
||||
#define DFLT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define DFLT_LOG_INFO(...) MODLOG_INFO(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_WARN(...) MODLOG_WARN(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_ERROR(...) MODLOG_ERROR(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_CRITICAL(...) MODLOG_CRITICAL(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_DISABLED(...) MODLOG_DISABLED(0, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef H_IGNORE_
|
||||
#define H_IGNORE_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* These macros prevent the "set but not used" warnings for log writes below
|
||||
* the log level.
|
||||
*/
|
||||
|
||||
#define IGN_1(X) ((void)(X))
|
||||
#define IGN_2(X, ...) ((void)(X));IGN_1(__VA_ARGS__)
|
||||
#define IGN_3(X, ...) ((void)(X));IGN_2(__VA_ARGS__)
|
||||
#define IGN_4(X, ...) ((void)(X));IGN_3(__VA_ARGS__)
|
||||
#define IGN_5(X, ...) ((void)(X));IGN_4(__VA_ARGS__)
|
||||
#define IGN_6(X, ...) ((void)(X));IGN_5(__VA_ARGS__)
|
||||
#define IGN_7(X, ...) ((void)(X));IGN_6(__VA_ARGS__)
|
||||
#define IGN_8(X, ...) ((void)(X));IGN_7(__VA_ARGS__)
|
||||
#define IGN_9(X, ...) ((void)(X));IGN_8(__VA_ARGS__)
|
||||
#define IGN_10(X, ...) ((void)(X));IGN_9(__VA_ARGS__)
|
||||
#define IGN_11(X, ...) ((void)(X));IGN_10(__VA_ARGS__)
|
||||
#define IGN_12(X, ...) ((void)(X));IGN_11(__VA_ARGS__)
|
||||
#define IGN_13(X, ...) ((void)(X));IGN_12(__VA_ARGS__)
|
||||
#define IGN_14(X, ...) ((void)(X));IGN_13(__VA_ARGS__)
|
||||
#define IGN_15(X, ...) ((void)(X));IGN_14(__VA_ARGS__)
|
||||
#define IGN_16(X, ...) ((void)(X));IGN_15(__VA_ARGS__)
|
||||
#define IGN_17(X, ...) ((void)(X));IGN_16(__VA_ARGS__)
|
||||
#define IGN_18(X, ...) ((void)(X));IGN_17(__VA_ARGS__)
|
||||
#define IGN_19(X, ...) ((void)(X));IGN_18(__VA_ARGS__)
|
||||
#define IGN_20(X, ...) ((void)(X));IGN_19(__VA_ARGS__)
|
||||
|
||||
#define GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, \
|
||||
_13, _14, _15, _16, _17, _18, _19, _20, NAME, ...) NAME
|
||||
#define IGNORE(...) \
|
||||
GET_MACRO(__VA_ARGS__, IGN_20, IGN_19, IGN_18, IGN_17, IGN_16, IGN_15, \
|
||||
IGN_14, IGN_13, IGN_12, IGN_11, IGN_10, IGN_9, IGN_8, IGN_7, \
|
||||
IGN_6, IGN_5, IGN_4, IGN_3, IGN_2, IGN_1)(__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef H_LOG_COMMON_
|
||||
#define H_LOG_COMMON_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "log_common/ignore.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct log;
|
||||
|
||||
#define LOG_VERSION_V3 3
|
||||
|
||||
#define LOG_TYPE_STREAM (0)
|
||||
#define LOG_TYPE_MEMORY (1)
|
||||
#define LOG_TYPE_STORAGE (2)
|
||||
|
||||
#define LOG_LEVEL_DEBUG (0)
|
||||
#define LOG_LEVEL_INFO (1)
|
||||
#define LOG_LEVEL_WARN (2)
|
||||
#define LOG_LEVEL_ERROR (3)
|
||||
#define LOG_LEVEL_CRITICAL (4)
|
||||
/* Up to 10 custom log levels. */
|
||||
#define LOG_LEVEL_MAX (15)
|
||||
|
||||
#define LOG_LEVEL_STR(level) \
|
||||
(LOG_LEVEL_DEBUG == level ? "DEBUG" :\
|
||||
(LOG_LEVEL_INFO == level ? "INFO" :\
|
||||
(LOG_LEVEL_WARN == level ? "WARN" :\
|
||||
(LOG_LEVEL_ERROR == level ? "ERROR" :\
|
||||
(LOG_LEVEL_CRITICAL == level ? "CRITICAL" :\
|
||||
"UNKNOWN")))))
|
||||
|
||||
/* XXX: These module IDs are defined for backwards compatibility. Application
|
||||
* code should use the syscfg settings directly. These defines will be removed
|
||||
* in a future release.
|
||||
*/
|
||||
#define LOG_MODULE_DEFAULT 0
|
||||
#define LOG_MODULE_OS 1
|
||||
#define LOG_MODULE_NEWTMGR 2
|
||||
#define LOG_MODULE_NIMBLE_CTLR 3
|
||||
#define LOG_MODULE_NIMBLE_HOST 4
|
||||
#define LOG_MODULE_NFFS 5
|
||||
#define LOG_MODULE_REBOOT 6
|
||||
#define LOG_MODULE_IOTIVITY 7
|
||||
#define LOG_MODULE_TEST 8
|
||||
|
||||
#define LOG_MODULE_PERUSER 64
|
||||
#define LOG_MODULE_MAX (255)
|
||||
|
||||
#define LOG_ETYPE_STRING (0)
|
||||
#define LOG_ETYPE_CBOR (1)
|
||||
#define LOG_ETYPE_BINARY (2)
|
||||
|
||||
/* UTC Timestamp for Jan 2016 00:00:00 */
|
||||
#define UTC01_01_2016 1451606400
|
||||
|
||||
#define LOG_NAME_MAX_LEN (64)
|
||||
|
||||
#ifndef MYNEWT_VAL_LOG_LEVEL
|
||||
#define LOG_SYSLEVEL ((uint8_t)LOG_LEVEL_MAX)
|
||||
#else
|
||||
#define LOG_SYSLEVEL ((uint8_t)MYNEWT_VAL_LOG_LEVEL)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Determines if a log module will accept an entry with a given level.
|
||||
*
|
||||
* A log entry is only accepted if its level is less than or equal to both:
|
||||
* o Global log level setting (LOG_LEVEL), and
|
||||
* o The specified module log level
|
||||
*
|
||||
* @param mod_level The module's minimum log level.
|
||||
* @param entry_level The level of the entry to be logged.
|
||||
*
|
||||
* @return true if the entry would be logged;
|
||||
* false otherwise.
|
||||
*/
|
||||
#define LOG_MOD_LEVEL_IS_ACTIVE(mod_level, entry_level) \
|
||||
(LOG_LEVEL <= (entry_level) && (mod_level) <= (entry_level))
|
||||
|
||||
/* Newtmgr Log opcodes */
|
||||
#define LOGS_NMGR_OP_READ (0)
|
||||
#define LOGS_NMGR_OP_CLEAR (1)
|
||||
#define LOGS_NMGR_OP_APPEND (2)
|
||||
#define LOGS_NMGR_OP_MODULE_LIST (3)
|
||||
#define LOGS_NMGR_OP_LEVEL_LIST (4)
|
||||
#define LOGS_NMGR_OP_LOGS_LIST (5)
|
||||
#define LOGS_NMGR_OP_SET_WATERMARK (6)
|
||||
#define LOGS_NMGR_OP_MODLEVEL (8)
|
||||
|
||||
#define LOG_PRINTF_MAX_ENTRY_LEN (128)
|
||||
|
||||
/* Global log info */
|
||||
struct log_info {
|
||||
#if MYNEWT_VAL(LOG_GLOBAL_IDX)
|
||||
uint32_t li_next_index;
|
||||
#endif
|
||||
uint8_t li_version;
|
||||
};
|
||||
|
||||
extern struct log_info g_log_info;
|
||||
|
||||
/** @typedef log_append_cb
|
||||
* @brief Callback that is executed each time the corresponding log is appended
|
||||
* to.
|
||||
*
|
||||
* @param log The log that was just appended to.
|
||||
* @param idx The index of newly appended log entry.
|
||||
*/
|
||||
typedef void log_append_cb(struct log *log, uint32_t idx);
|
||||
|
||||
/** @typdef log_notify_rotate_cb
|
||||
* @brief Callback that is executed each time we are about to rotate a log.
|
||||
*
|
||||
* @param log The log that is about to rotate
|
||||
*/
|
||||
typedef void log_notify_rotate_cb(const struct log *log);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.11.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_LOGCFG_
|
||||
#define H_MYNEWT_LOGCFG_
|
||||
|
||||
#include "modlog/modlog.h"
|
||||
#include "log_common/log_common.h"
|
||||
|
||||
#define BLE_EATT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_EATT_LOG_INFO(...) MODLOG_INFO(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_WARN(...) MODLOG_WARN(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_ERROR(...) MODLOG_ERROR(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_CRITICAL(...) MODLOG_CRITICAL(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_DISABLED(...) MODLOG_DISABLED(22, __VA_ARGS__)
|
||||
|
||||
#define BLE_HS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_HS_LOG_INFO(...) MODLOG_INFO(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_WARN(...) MODLOG_WARN(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_ERROR(...) MODLOG_ERROR(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_CRITICAL(...) MODLOG_CRITICAL(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_DISABLED(...) MODLOG_DISABLED(4, __VA_ARGS__)
|
||||
|
||||
#define DFLT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define DFLT_LOG_INFO(...) MODLOG_INFO(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_WARN(...) MODLOG_WARN(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_ERROR(...) MODLOG_ERROR(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_CRITICAL(...) MODLOG_CRITICAL(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_DISABLED(...) MODLOG_DISABLED(0, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef H_MODLOG_
|
||||
#define H_MODLOG_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "log_common/log_common.h"
|
||||
#include "log/log.h"
|
||||
|
||||
#define MODLOG_MODULE_DFLT 255
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_DEBUG || defined __DOXYGEN__
|
||||
#define MODLOG_DEBUG(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_DEBUG(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_INFO || defined __DOXYGEN__
|
||||
#define MODLOG_INFO(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_INFO(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_WARN || defined __DOXYGEN__
|
||||
#define MODLOG_WARN(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_WARN(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_ERROR || defined __DOXYGEN__
|
||||
#define MODLOG_ERROR(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_ERROR(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_CRITICAL || defined __DOXYGEN__
|
||||
#define MODLOG_CRITICAL(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_CRITICAL(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define MODLOG(ml_lvl_, ml_mod_, ...) \
|
||||
MODLOG_ ## ml_lvl_((ml_mod_), __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NIMBLE_NPL_OS_LOG_H_
|
||||
#define _NIMBLE_NPL_OS_LOG_H_
|
||||
|
||||
#define BLE_NPL_LOG_IMPL(lvl) \
|
||||
static inline void _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, \
|
||||
_BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...) { }
|
||||
|
||||
#endif /* _NIMBLE_NPL_OS_LOG_H_ */
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NIMBLE_NPL_OS_LOG_H_
|
||||
#define _NIMBLE_NPL_OS_LOG_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Example on how to use macro to generate module logging functions */
|
||||
#define BLE_NPL_LOG_IMPL(lvl) \
|
||||
static inline void _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, \
|
||||
_BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...)\
|
||||
{ \
|
||||
va_list args; \
|
||||
va_start(args, fmt); \
|
||||
vprintf(fmt, args); \
|
||||
va_end(args); \
|
||||
}
|
||||
|
||||
#endif /* _NIMBLE_NPL_OS_LOG_H_ */
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NIMBLE_NPL_OS_LOG_H_
|
||||
#define _NIMBLE_NPL_OS_LOG_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Example on how to use macro to generate module logging functions */
|
||||
#define BLE_NPL_LOG_IMPL(lvl) \
|
||||
static inline void _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, \
|
||||
_BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...)\
|
||||
{ \
|
||||
va_list args; \
|
||||
va_start(args, fmt); \
|
||||
vprintf(fmt, args); \
|
||||
va_end(args); \
|
||||
}
|
||||
|
||||
#endif /* _NIMBLE_NPL_OS_LOG_H_ */
|
||||
+9
-26
@@ -17,32 +17,15 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#ifndef __LOG_H__
|
||||
#define __LOG_H__
|
||||
#ifndef _NIMBLE_NPL_OS_LOG_H_
|
||||
#define _NIMBLE_NPL_OS_LOG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#include <modlog/modlog.h>
|
||||
#include <log/log.h>
|
||||
|
||||
/* Only include the logcfg header if this version of newt can generate it. */
|
||||
#if MYNEWT_VAL(NEWT_FEATURE_LOGCFG)
|
||||
#include <logcfg/logcfg.h>
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
log_dummy(void *log, ...)
|
||||
{
|
||||
(void)log;
|
||||
}
|
||||
|
||||
#ifdef MYNEWT
|
||||
#define LOG_DEBUG(_log, _mod, ...) log_dummy(_log, ## __VA_ARGS__)
|
||||
#define LOG_INFO(_log, _mod, ...) log_dummy(_log, ## __VA_ARGS__)
|
||||
#define LOG_WARN(_log, _mod, ...) log_dummy(_log, ## __VA_ARGS__)
|
||||
#define LOG_ERROR(_log, _mod, ...) log_dummy(_log, ## __VA_ARGS__)
|
||||
#define LOG_CRITICAL(_log, _mod, ...) log_dummy(_log, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
struct log {
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LOG_H__ */
|
||||
#endif /* _NIMBLE_NPL_OS_LOG_H_ */
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef H_MODLOG_
|
||||
#define H_MODLOG_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "log_common/log_common.h"
|
||||
|
||||
#define MODLOG_MODULE_DFLT 255
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_DEBUG || defined __DOXYGEN__
|
||||
#define MODLOG_DEBUG(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_DEBUG(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_INFO || defined __DOXYGEN__
|
||||
#define MODLOG_INFO(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_INFO(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_WARN || defined __DOXYGEN__
|
||||
#define MODLOG_WARN(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_WARN(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_ERROR || defined __DOXYGEN__
|
||||
#define MODLOG_ERROR(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_ERROR(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(LOG_LEVEL) <= LOG_LEVEL_CRITICAL || defined __DOXYGEN__
|
||||
#define MODLOG_CRITICAL(ml_mod_, ml_msg_, ...) \
|
||||
printf((ml_msg_), ##__VA_ARGS__)
|
||||
#else
|
||||
#define MODLOG_CRITICAL(ml_mod_, ...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define MODLOG(ml_lvl_, ml_mod_, ...) \
|
||||
MODLOG_ ## ml_lvl_((ml_mod_), __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NIMBLE_NPL_OS_LOG_H_
|
||||
#define _NIMBLE_NPL_OS_LOG_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Example on how to use macro to generate module logging functions */
|
||||
#define BLE_NPL_LOG_IMPL(lvl) \
|
||||
static inline void _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, \
|
||||
_BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...)\
|
||||
{ \
|
||||
va_list args; \
|
||||
va_start(args, fmt); \
|
||||
vprintf(fmt, args); \
|
||||
va_end(args); \
|
||||
}
|
||||
|
||||
#endif /* _NIMBLE_NPL_OS_LOG_H_ */
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.11.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_LOGCFG_
|
||||
#define H_MYNEWT_LOGCFG_
|
||||
|
||||
#include "modlog/modlog.h"
|
||||
#include "log_common/log_common.h"
|
||||
|
||||
#define BLE_EATT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_EATT_LOG_INFO(...) MODLOG_INFO(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_WARN(...) MODLOG_WARN(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_ERROR(...) MODLOG_ERROR(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_CRITICAL(...) MODLOG_CRITICAL(22, __VA_ARGS__)
|
||||
#define BLE_EATT_LOG_DISABLED(...) MODLOG_DISABLED(22, __VA_ARGS__)
|
||||
|
||||
#define BLE_HS_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define BLE_HS_LOG_INFO(...) MODLOG_INFO(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_WARN(...) MODLOG_WARN(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_ERROR(...) MODLOG_ERROR(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_CRITICAL(...) MODLOG_CRITICAL(4, __VA_ARGS__)
|
||||
#define BLE_HS_LOG_DISABLED(...) MODLOG_DISABLED(4, __VA_ARGS__)
|
||||
|
||||
#define DFLT_LOG_DEBUG(...) IGNORE(__VA_ARGS__)
|
||||
#define DFLT_LOG_INFO(...) MODLOG_INFO(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_WARN(...) MODLOG_WARN(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_ERROR(...) MODLOG_ERROR(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_CRITICAL(...) MODLOG_CRITICAL(0, __VA_ARGS__)
|
||||
#define DFLT_LOG_DISABLED(...) MODLOG_DISABLED(0, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NIMBLE_NPL_OS_LOG_H_
|
||||
#define _NIMBLE_NPL_OS_LOG_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Example on how to use macro to generate module logging functions */
|
||||
#define BLE_NPL_LOG_IMPL(lvl) \
|
||||
static inline void _BLE_NPL_LOG_CAT(BLE_NPL_LOG_MODULE, \
|
||||
_BLE_NPL_LOG_CAT(_, lvl))(const char *fmt, ...)\
|
||||
{ \
|
||||
va_list args; \
|
||||
va_start(args, fmt); \
|
||||
vprintf(fmt, args); \
|
||||
va_end(args); \
|
||||
}
|
||||
|
||||
#endif /* _NIMBLE_NPL_OS_LOG_H_ */
|
||||
Reference in New Issue
Block a user