blob: 49e1c152fd09b90a5add003f079cdb14081f49e3 [file] [log] [blame]
Soby Mathewaaf15f52017-09-04 11:49:29 +01001/*
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +01002 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
Soby Mathewaaf15f52017-09-04 11:49:29 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Soby Mathewaaf15f52017-09-04 11:49:29 +01007#include <debug.h>
Soby Mathewaaf15f52017-09-04 11:49:29 +01008
9/* Allow platforms to override the log prefix string */
10#pragma weak plat_log_get_prefix
11
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +010012static const char *plat_prefix_str[] = {
Soby Mathewaaf15f52017-09-04 11:49:29 +010013 "ERROR: ", "NOTICE: ", "WARNING: ", "INFO: ", "VERBOSE: "};
14
15const char *plat_log_get_prefix(unsigned int log_level)
16{
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +010017 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 }
Soby Mathewaaf15f52017-09-04 11:49:29 +010026
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +010027 return plat_prefix_str[(level / 10U) - 1U];
Soby Mathewaaf15f52017-09-04 11:49:29 +010028}