File: logger.h

package info (click to toggle)
ceccomp 3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,528 kB
  • sloc: ansic: 3,154; python: 653; makefile: 240; sh: 226
file content (22 lines) | stat: -rw-r--r-- 954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef LOGGER
#define LOGGER

#include <sys/cdefs.h>
// clang-format off
__attribute__ ((noinline)) void debug_print (const char *caller_func, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
__attribute__ ((noinline)) void info_print (const char *caller_func, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
__attribute__ ((noinline)) void warn_print (const char *caller_func, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
__attribute__ ((noinline)) __attribute__ ((noreturn)) void error_print (const char *caller_func, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
// clang-format on

#ifdef DEBUG
#define debug(fmt, ...) debug_print (__func__, fmt, __VA_ARGS__)
#else
#define debug(fmt, ...) ;
#endif // !DEBUG

#define info(fmt, ...) info_print (__func__, fmt, __VA_ARGS__)
#define warn(fmt, ...) warn_print (__func__, fmt, __VA_ARGS__)
#define error(fmt, ...) error_print (__func__, fmt, __VA_ARGS__)

#endif