Merge branch 'bugfix/ot-log-verbosity' into 'master'

openthread: reduce default log verbosity

See merge request espressif/esp-idf!15326
This commit is contained in:
Guo Jia Cheng
2021-10-14 09:46:49 +00:00
7 changed files with 32 additions and 46 deletions

View File

@@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD /*
// * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// 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
#pragma once #pragma once
@@ -56,21 +48,15 @@
* verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level. * verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level.
* *
*/ */
#ifndef OPENTHREAD_CONFIG_LOG_LEVEL
#if CONFIG_LOG_DEFAULT_LEVEL_NONE
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_NONE
#elif CONFIG_LOG_DEFAULT_LEVEL_ERROR
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_CRIT
#elif CONFIG_LOG_DEFAULT_LEVEL_WARN
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_WARN
#elif CONFIG_LOG_DEFAULT_LEVEL_INFO
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO
#elif CONFIG_LOG_DEFAULT_LEVEL_DEBUG
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
#elif CONFIG_LOG_DEFAULT_LEVEL_VERBOSE
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG /**
#endif * @def OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
#endif *
* Define as 1 to enable dynamic log level control.
*
*/
#define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1
#define OPENTHREAD_CONFIG_LOG_API 1 #define OPENTHREAD_CONFIG_LOG_API 1
#define OPENTHREAD_CONFIG_LOG_ARP 1 #define OPENTHREAD_CONFIG_LOG_ARP 1

View File

@@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD /*
// * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// 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
#pragma once #pragma once
@@ -63,9 +55,9 @@
#elif CONFIG_LOG_DEFAULT_LEVEL_WARN #elif CONFIG_LOG_DEFAULT_LEVEL_WARN
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_WARN #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_WARN
#elif CONFIG_LOG_DEFAULT_LEVEL_INFO #elif CONFIG_LOG_DEFAULT_LEVEL_INFO
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_WARN
#elif CONFIG_LOG_DEFAULT_LEVEL_DEBUG #elif CONFIG_LOG_DEFAULT_LEVEL_DEBUG
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO
#elif CONFIG_LOG_DEFAULT_LEVEL_VERBOSE #elif CONFIG_LOG_DEFAULT_LEVEL_VERBOSE
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
#endif #endif

View File

@@ -42,6 +42,7 @@
#include "openthread/error.h" #include "openthread/error.h"
#include "openthread/instance.h" #include "openthread/instance.h"
#include "openthread/ip6.h" #include "openthread/ip6.h"
#include "openthread/logging.h"
#include "openthread/tasklet.h" #include "openthread/tasklet.h"
#include "openthread/thread.h" #include "openthread/thread.h"
#include "openthread/thread_ftd.h" #include "openthread/thread_ftd.h"
@@ -168,6 +169,7 @@ static void ot_task_worker(void *aContext)
ESP_ERROR_CHECK(esp_openthread_border_router_init(get_example_netif())); ESP_ERROR_CHECK(esp_openthread_border_router_init(get_example_netif()));
esp_openthread_lock_acquire(portMAX_DELAY); esp_openthread_lock_acquire(portMAX_DELAY);
(void)otLoggingSetLevel(CONFIG_LOG_DEFAULT_LEVEL);
otAppCliInit(esp_openthread_get_instance()); otAppCliInit(esp_openthread_get_instance());
create_config_network(esp_openthread_get_instance()); create_config_network(esp_openthread_get_instance());
launch_openthread_network(esp_openthread_get_instance()); launch_openthread_network(esp_openthread_get_instance());

View File

@@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* OpenThread Command Line Example /* OpenThread Command Line Example
This example code is in the Public Domain (or CC0 licensed, at your option.) This example code is in the Public Domain (or CC0 licensed, at your option.)
@@ -28,6 +33,7 @@
#include "hal/uart_types.h" #include "hal/uart_types.h"
#include "openthread/cli.h" #include "openthread/cli.h"
#include "openthread/instance.h" #include "openthread/instance.h"
#include "openthread/logging.h"
#include "openthread/tasklet.h" #include "openthread/tasklet.h"
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION #if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
@@ -61,6 +67,8 @@ static void ot_task_worker(void *aContext)
// Initialize the OpenThread stack // Initialize the OpenThread stack
ESP_ERROR_CHECK(esp_openthread_init(&config)); ESP_ERROR_CHECK(esp_openthread_init(&config));
// The OpenThread log level directly matches ESP log level
(void)otLoggingSetLevel(CONFIG_LOG_DEFAULT_LEVEL);
// Initialize the OpenThread cli // Initialize the OpenThread cli
otAppCliInit(esp_openthread_get_instance()); otAppCliInit(esp_openthread_get_instance());

View File

@@ -2091,8 +2091,6 @@ components/openthread/include/esp_openthread_border_router.h
components/openthread/include/esp_openthread_lock.h components/openthread/include/esp_openthread_lock.h
components/openthread/include/esp_openthread_netif_glue.h components/openthread/include/esp_openthread_netif_glue.h
components/openthread/include/esp_openthread_types.h components/openthread/include/esp_openthread_types.h
components/openthread/private_include/openthread-core-esp32x-ftd-config.h
components/openthread/private_include/openthread-core-esp32x-radio-config.h
components/partition_table/check_sizes.py components/partition_table/check_sizes.py
components/partition_table/gen_empty_partition.py components/partition_table/gen_empty_partition.py
components/partition_table/gen_esp32part.py components/partition_table/gen_esp32part.py