blob: 66b9758bca9705d9da66c732b363c2bdd79ad4c0 [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
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00007#include <common/debug.h>
8#include <plat/common/platform.h>
Soby Mathewaaf15f52017-09-04 11:49:29 +01009
10/* Allow platforms to override the log prefix string */
11#pragma weak plat_log_get_prefix
12
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +010013static const char *plat_prefix_str[] = {
Soby Mathewaaf15f52017-09-04 11:49:29 +010014 "ERROR: ", "NOTICE: ", "WARNING: ", "INFO: ", "VERBOSE: "};
15
16const char *plat_log_get_prefix(unsigned int log_level)
17{
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +010018 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 }
Soby Mathewaaf15f52017-09-04 11:49:29 +010027
Antonio Nino Diaz14fabd02018-08-28 11:44:44 +010028 return plat_prefix_str[(level / 10U) - 1U];
Soby Mathewaaf15f52017-09-04 11:49:29 +010029}