blob: 3df5c5ce099f31d2238526f62a6706c4ea8ccc01 [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
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 Gottardi8df12f32021-04-07 17:15:31 +010035 #define trace(...) printf("TRACE - "); printf(__VA_ARGS__)
alexander3c798932021-03-26 21:42:19 +000036#else
37 #define trace(...)
38#endif /* LOG_LEVEL == LOG_LEVEL_TRACE */
39
40#if (LOG_LEVEL <= LOG_LEVEL_DEBUG)
Isabella Gottardi8df12f32021-04-07 17:15:31 +010041 #define debug(...) printf("DEBUG - "); printf(__VA_ARGS__)
alexander3c798932021-03-26 21:42:19 +000042#else
43 #define debug(...)
44#endif /* LOG_LEVEL > LOG_LEVEL_TRACE */
45
46#if (LOG_LEVEL <= LOG_LEVEL_INFO)
Isabella Gottardi8df12f32021-04-07 17:15:31 +010047 #define info(...) printf("INFO - "); printf(__VA_ARGS__)
alexander3c798932021-03-26 21:42:19 +000048#else
49 #define info(...)
50#endif /* LOG_LEVEL > LOG_LEVEL_DEBUG */
51
52#if (LOG_LEVEL <= LOG_LEVEL_WARN)
Isabella Gottardi8df12f32021-04-07 17:15:31 +010053 #define warn(...) printf("WARN - "); printf(__VA_ARGS__)
alexander3c798932021-03-26 21:42:19 +000054#else
55 #define warn(...)
56#endif /* LOG_LEVEL > LOG_LEVEL_INFO */
57
58#if (LOG_LEVEL <= LOG_LEVEL_ERROR)
Isabella Gottardi8df12f32021-04-07 17:15:31 +010059 #define printf_err(...) printf("ERROR - "); printf(__VA_ARGS__)
alexander3c798932021-03-26 21:42:19 +000060#else
61 #define printf_err(...)
62#endif /* LOG_LEVEL > LOG_LEVEL_INFO */
63
64#endif /* DUMMY_LOG_H */