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 <common/debug.h>
8 #include <plat/common/platform.h>
9 
10 /* Allow platforms to override the log prefix string */
11 #pragma weak plat_log_get_prefix
12 
13 static const char *plat_prefix_str[] = {
14 	"ERROR:   ", "NOTICE:  ", "WARNING: ", "INFO:    ", "VERBOSE: "};
15 
plat_log_get_prefix(unsigned int log_level)16 const char *plat_log_get_prefix(unsigned int log_level)
17 {
18 	unsigned int level;
19 
20 	if (log_level < LOG_LEVEL_ERROR) {
21 		level = LOG_LEVEL_ERROR;
22 	} else if (log_level > LOG_LEVEL_VERBOSE) {
23 		level = LOG_LEVEL_VERBOSE;
24 	} else {
25 		level = log_level;
26 	}
27 
28 	return plat_prefix_str[(level / 10U) - 1U];
29 }
30