blob: c757c6bf1a375f7f7f38c1fb3b71f573104fe87e [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>
Yann Gautier3364cd42018-12-10 10:41:03 +01008#include <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}