plat_log_common.c 690 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <common/debug.h>
  7. #include <plat/common/platform.h>
  8. /* Allow platforms to override the log prefix string */
  9. #pragma weak plat_log_get_prefix
  10. static const char *plat_prefix_str[] = {
  11. "ERROR: ", "NOTICE: ", "WARNING: ", "INFO: ", "VERBOSE: "};
  12. const char *plat_log_get_prefix(unsigned int log_level)
  13. {
  14. unsigned int level;
  15. if (log_level < LOG_LEVEL_ERROR) {
  16. level = LOG_LEVEL_ERROR;
  17. } else if (log_level > LOG_LEVEL_VERBOSE) {
  18. level = LOG_LEVEL_VERBOSE;
  19. } else {
  20. level = log_level;
  21. }
  22. return plat_prefix_str[(level / 10U) - 1U];
  23. }