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