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