diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2018-03-13 09:43:43 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2018-03-13 09:43:44 +0000 |
| commit | 73988d529e2edfc0c83cb73c07f818fdfebd633c (patch) | |
| tree | 522d73658f6c1023cdee283808d6979363f5fe42 /include/qemu/log-for-trace.h | |
| parent | 1396156f50ddcfffc0e3127a005b3cdcf6fcee60 (diff) | |
| parent | 73ff061032efa0b260bcd1a177ac89b57a1642d3 (diff) | |
| download | focaccia-qemu-73988d529e2edfc0c83cb73c07f818fdfebd633c.tar.gz focaccia-qemu-73988d529e2edfc0c83cb73c07f818fdfebd633c.zip | |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
# gpg: Signature made Mon 12 Mar 2018 15:59:54 GMT # gpg: using RSA key 9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/tracing-pull-request: trace: only permit standard C types and fixed size integer types trace: remove use of QEMU specific types from trace probes trace: include filename when printing parser error messages simpletrace: fix timestamp argument type log-for-trace.h: Split out parts of log.h used by trace.h Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/qemu/log-for-trace.h')
| -rw-r--r-- | include/qemu/log-for-trace.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/qemu/log-for-trace.h b/include/qemu/log-for-trace.h new file mode 100644 index 0000000000..2f0a5b080e --- /dev/null +++ b/include/qemu/log-for-trace.h @@ -0,0 +1,35 @@ +/* log-for-trace.h: logging basics required by the trace.h generated + * by the log trace backend. + * + * This should not be included directly by any .c file: if you + * need to use the logging functions include "qemu/log.h". + * + * The purpose of splitting these parts out into their own header + * is to catch the easy mistake where a .c file includes trace.h + * but forgets to include qemu/log.h. Without this split, that + * would result in the .c file compiling fine when the default + * trace backend is in use but failing to compile with any other + * backend. + * + * This code is licensed under the GNU General Public License, + * version 2 or (at your option) any later version. + */ + +#ifndef QEMU_LOG_FOR_TRACE_H +#define QEMU_LOG_FOR_TRACE_H + +/* Private global variable, don't use */ +extern int qemu_loglevel; + +#define LOG_TRACE (1 << 15) + +/* Returns true if a bit is set in the current loglevel mask */ +static inline bool qemu_loglevel_mask(int mask) +{ + return (qemu_loglevel & mask) != 0; +} + +/* main logging function */ +int GCC_FMT_ATTR(1, 2) qemu_log(const char *fmt, ...); + +#endif |