Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libserialport libxml2
debug.h@4:ad69b39bf124, 2017-06-26 (annotated)
- Committer:
- pcercuei
- Date:
- Mon Jun 26 14:30:10 2017 +0000
- Revision:
- 4:ad69b39bf124
- Parent:
- 2:9eb0a9a1f958
Update to upstream version v0.10
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pcercuei | 0:df031b60ca29 | 1 | /* |
pcercuei | 0:df031b60ca29 | 2 | * libiio - Library for interfacing industrial I/O (IIO) devices |
pcercuei | 0:df031b60ca29 | 3 | * |
pcercuei | 0:df031b60ca29 | 4 | * Copyright (C) 2014 Analog Devices, Inc. |
pcercuei | 0:df031b60ca29 | 5 | * Author: Paul Cercueil <paul.cercueil@analog.com> |
pcercuei | 0:df031b60ca29 | 6 | * |
pcercuei | 0:df031b60ca29 | 7 | * This library is free software; you can redistribute it and/or |
pcercuei | 0:df031b60ca29 | 8 | * modify it under the terms of the GNU Lesser General Public |
pcercuei | 0:df031b60ca29 | 9 | * License as published by the Free Software Foundation; either |
pcercuei | 0:df031b60ca29 | 10 | * version 2.1 of the License, or (at your option) any later version. |
pcercuei | 0:df031b60ca29 | 11 | * |
pcercuei | 0:df031b60ca29 | 12 | * This library is distributed in the hope that it will be useful, |
pcercuei | 0:df031b60ca29 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
pcercuei | 0:df031b60ca29 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
pcercuei | 0:df031b60ca29 | 15 | * Lesser General Public License for more details. |
pcercuei | 0:df031b60ca29 | 16 | * |
pcercuei | 0:df031b60ca29 | 17 | * */ |
pcercuei | 0:df031b60ca29 | 18 | |
pcercuei | 0:df031b60ca29 | 19 | #ifndef DEBUG_H |
pcercuei | 0:df031b60ca29 | 20 | #define DEBUG_H |
pcercuei | 0:df031b60ca29 | 21 | |
pcercuei | 2:9eb0a9a1f958 | 22 | #include "iio-config.h" |
pcercuei | 2:9eb0a9a1f958 | 23 | |
pcercuei | 0:df031b60ca29 | 24 | #include <stdio.h> |
pcercuei | 0:df031b60ca29 | 25 | |
pcercuei | 2:9eb0a9a1f958 | 26 | #define NoLog_L 0 |
pcercuei | 2:9eb0a9a1f958 | 27 | #define Error_L 1 |
pcercuei | 2:9eb0a9a1f958 | 28 | #define Warning_L 2 |
pcercuei | 2:9eb0a9a1f958 | 29 | #define Info_L 3 |
pcercuei | 2:9eb0a9a1f958 | 30 | #define Debug_L 4 |
pcercuei | 0:df031b60ca29 | 31 | |
pcercuei | 0:df031b60ca29 | 32 | /* -------------------- */ |
pcercuei | 0:df031b60ca29 | 33 | |
pcercuei | 0:df031b60ca29 | 34 | #ifdef WITH_COLOR_DEBUG |
pcercuei | 0:df031b60ca29 | 35 | #ifndef COLOR_DEBUG |
pcercuei | 4:ad69b39bf124 | 36 | #define COLOR_DEBUG "\e[0;32m" |
pcercuei | 0:df031b60ca29 | 37 | #endif |
pcercuei | 0:df031b60ca29 | 38 | #ifndef COLOR_WARNING |
pcercuei | 0:df031b60ca29 | 39 | #define COLOR_WARNING "\e[01;35m" |
pcercuei | 0:df031b60ca29 | 40 | #endif |
pcercuei | 0:df031b60ca29 | 41 | #ifndef COLOR_ERROR |
pcercuei | 0:df031b60ca29 | 42 | #define COLOR_ERROR "\e[01;31m" |
pcercuei | 0:df031b60ca29 | 43 | #endif |
pcercuei | 0:df031b60ca29 | 44 | |
pcercuei | 0:df031b60ca29 | 45 | #define COLOR_END "\e[0m" |
pcercuei | 0:df031b60ca29 | 46 | #endif |
pcercuei | 0:df031b60ca29 | 47 | |
pcercuei | 2:9eb0a9a1f958 | 48 | #if (LOG_LEVEL >= Debug_L) |
pcercuei | 0:df031b60ca29 | 49 | # ifdef COLOR_DEBUG |
pcercuei | 0:df031b60ca29 | 50 | # define DEBUG(str, ...) \ |
pcercuei | 0:df031b60ca29 | 51 | fprintf(stdout, COLOR_DEBUG "DEBUG: " str COLOR_END, ##__VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 52 | # else |
pcercuei | 0:df031b60ca29 | 53 | # define DEBUG(...) \ |
pcercuei | 0:df031b60ca29 | 54 | fprintf(stdout, "DEBUG: " __VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 55 | # endif |
pcercuei | 0:df031b60ca29 | 56 | #else |
pcercuei | 2:9eb0a9a1f958 | 57 | #define DEBUG(...) do { } while (0) |
pcercuei | 0:df031b60ca29 | 58 | #endif |
pcercuei | 0:df031b60ca29 | 59 | |
pcercuei | 2:9eb0a9a1f958 | 60 | #if (LOG_LEVEL >= Info_L) |
pcercuei | 0:df031b60ca29 | 61 | # ifdef COLOR_INFO |
pcercuei | 0:df031b60ca29 | 62 | # define INFO(str, ...) \ |
pcercuei | 0:df031b60ca29 | 63 | fprintf(stdout, COLOR_INFO str COLOR_END, ##__VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 64 | # else |
pcercuei | 0:df031b60ca29 | 65 | # define INFO(...) \ |
pcercuei | 0:df031b60ca29 | 66 | fprintf(stdout, __VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 67 | # endif |
pcercuei | 0:df031b60ca29 | 68 | #else |
pcercuei | 2:9eb0a9a1f958 | 69 | #define INFO(...) do { } while (0) |
pcercuei | 0:df031b60ca29 | 70 | #endif |
pcercuei | 0:df031b60ca29 | 71 | |
pcercuei | 2:9eb0a9a1f958 | 72 | #if (LOG_LEVEL >= Warning_L) |
pcercuei | 0:df031b60ca29 | 73 | # ifdef COLOR_WARNING |
pcercuei | 0:df031b60ca29 | 74 | # define WARNING(str, ...) \ |
pcercuei | 0:df031b60ca29 | 75 | fprintf(stderr, COLOR_WARNING "WARNING: " str COLOR_END, ##__VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 76 | # else |
pcercuei | 0:df031b60ca29 | 77 | # define WARNING(...) \ |
pcercuei | 0:df031b60ca29 | 78 | fprintf(stderr, "WARNING: " __VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 79 | # endif |
pcercuei | 0:df031b60ca29 | 80 | #else |
pcercuei | 2:9eb0a9a1f958 | 81 | #define WARNING(...) do { } while (0) |
pcercuei | 0:df031b60ca29 | 82 | #endif |
pcercuei | 0:df031b60ca29 | 83 | |
pcercuei | 2:9eb0a9a1f958 | 84 | #if (LOG_LEVEL >= Error_L) |
pcercuei | 0:df031b60ca29 | 85 | # ifdef COLOR_ERROR |
pcercuei | 0:df031b60ca29 | 86 | # define ERROR(str, ...) \ |
pcercuei | 0:df031b60ca29 | 87 | fprintf(stderr, COLOR_ERROR "ERROR: " str COLOR_END, ##__VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 88 | # else |
pcercuei | 0:df031b60ca29 | 89 | # define ERROR(...) \ |
pcercuei | 0:df031b60ca29 | 90 | fprintf(stderr, "ERROR: " __VA_ARGS__) |
pcercuei | 0:df031b60ca29 | 91 | # endif |
pcercuei | 0:df031b60ca29 | 92 | #else |
pcercuei | 2:9eb0a9a1f958 | 93 | #define ERROR(...) do { } while (0) |
pcercuei | 0:df031b60ca29 | 94 | #endif |
pcercuei | 0:df031b60ca29 | 95 | |
pcercuei | 0:df031b60ca29 | 96 | #endif |
pcercuei | 0:df031b60ca29 | 97 |