log_linked_list.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdbool.h>
  8. #include "esp_log.h"
  9. /**
  10. * @brief Set the log level for a specific log tag using the linked list
  11. * approach.
  12. *
  13. * If the tag already exists in the linked list, its log level will be updated
  14. * with the new value. If the tag is not found in the linked list, a new entry
  15. * will be appended to the linked list with the provided log level.
  16. *
  17. * @param tag The log tag for which to set the log level.
  18. * @param level The log level to be set for the specified log tag.
  19. * @return true If the log level was successfully set or updated,
  20. * false Otherwise.
  21. */
  22. bool esp_log_linked_list_set_level(const char *tag, esp_log_level_t level);
  23. /**
  24. * @brief Get the log level for a specific log tag using the linked list
  25. * approach.
  26. *
  27. * If the tag is found in the linked list, its corresponding log level will be
  28. * returned.
  29. *
  30. * @param tag The log tag for which to retrieve the log level.
  31. * @param level Pointer to a variable where the retrieved log level will be
  32. * stored.
  33. * @return true if the log level was successfully retrieved from the linked list,
  34. * false if the tag was not found in the linked list.
  35. */
  36. bool esp_log_linked_list_get_level(const char *tag, esp_log_level_t *level);
  37. /**
  38. * @brief Clears the linked list of all tags and frees the allocated memory for
  39. * each tag entry.
  40. *
  41. * This function clears the linked list of all tags that have been set using
  42. * esp_log_level_set(). It also frees the memory allocated for each tag entry in
  43. * the linked list.
  44. */
  45. void esp_log_linked_list_clean(void);