alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 Arm Limited. All rights reserved. |
| 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | #ifndef DUMMY_LOG_H |
| 18 | #define DUMMY_LOG_H |
| 19 | |
| 20 | #include <stdio.h> |
| 21 | |
| 22 | #define LOG_LEVEL_TRACE 0 |
| 23 | #define LOG_LEVEL_DEBUG 1 |
| 24 | #define LOG_LEVEL_INFO 2 |
| 25 | #define LOG_LEVEL_WARN 3 |
| 26 | #define LOG_LEVEL_ERROR 4 |
| 27 | |
| 28 | #ifndef LOG_LEVEL |
| 29 | #define LOG_LEVEL LOG_LEVEL_INFO |
| 30 | #endif /*LOG_LEVEL*/ |
| 31 | |
| 32 | #define UNUSED(x) ((void)(x)) |
| 33 | |
| 34 | #if (LOG_LEVEL == LOG_LEVEL_TRACE) |
Isabella Gottardi | 8df12f3 | 2021-04-07 17:15:31 +0100 | [diff] [blame^] | 35 | #define trace(...) printf("TRACE - "); printf(__VA_ARGS__) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 36 | #else |
| 37 | #define trace(...) |
| 38 | #endif /* LOG_LEVEL == LOG_LEVEL_TRACE */ |
| 39 | |
| 40 | #if (LOG_LEVEL <= LOG_LEVEL_DEBUG) |
Isabella Gottardi | 8df12f3 | 2021-04-07 17:15:31 +0100 | [diff] [blame^] | 41 | #define debug(...) printf("DEBUG - "); printf(__VA_ARGS__) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 42 | #else |
| 43 | #define debug(...) |
| 44 | #endif /* LOG_LEVEL > LOG_LEVEL_TRACE */ |
| 45 | |
| 46 | #if (LOG_LEVEL <= LOG_LEVEL_INFO) |
Isabella Gottardi | 8df12f3 | 2021-04-07 17:15:31 +0100 | [diff] [blame^] | 47 | #define info(...) printf("INFO - "); printf(__VA_ARGS__) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 48 | #else |
| 49 | #define info(...) |
| 50 | #endif /* LOG_LEVEL > LOG_LEVEL_DEBUG */ |
| 51 | |
| 52 | #if (LOG_LEVEL <= LOG_LEVEL_WARN) |
Isabella Gottardi | 8df12f3 | 2021-04-07 17:15:31 +0100 | [diff] [blame^] | 53 | #define warn(...) printf("WARN - "); printf(__VA_ARGS__) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 54 | #else |
| 55 | #define warn(...) |
| 56 | #endif /* LOG_LEVEL > LOG_LEVEL_INFO */ |
| 57 | |
| 58 | #if (LOG_LEVEL <= LOG_LEVEL_ERROR) |
Isabella Gottardi | 8df12f3 | 2021-04-07 17:15:31 +0100 | [diff] [blame^] | 59 | #define printf_err(...) printf("ERROR - "); printf(__VA_ARGS__) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 60 | #else |
| 61 | #define printf_err(...) |
| 62 | #endif /* LOG_LEVEL > LOG_LEVEL_INFO */ |
| 63 | |
| 64 | #endif /* DUMMY_LOG_H */ |