38 #ifndef MAVROSFLIGHT_DEFAULT_LOGGER_H 39 #define MAVROSFLIGHT_DEFAULT_LOGGER_H 56 template <
typename... Args>
57 inline void debug(
const char* format,
const Args&...
args)
59 _log(stdout,
"DEBUG", format, args...);
61 template <
typename... Args>
64 debug(format, args...);
67 template <
typename... Args>
68 inline void info(
const char* format,
const Args&...
args)
70 _log(stdout,
"INFO", format, args...);
72 template <
typename... Args>
75 info(format, args...);
78 template <
typename... Args>
79 inline void warn(
const char* format,
const Args&...
args)
81 _log(stderr,
"WARN", format, args...);
83 template <
typename... Args>
86 warn(format, args...);
89 template <
typename... Args>
90 inline void error(
const char* format,
const Args&...
args)
92 _log(stderr,
"ERROR", format, args...);
94 template <
typename... Args>
97 error(format, args...);
100 template <
typename... Args>
101 inline void fatal(
const char* format,
const Args&...
args)
103 _log(stderr,
"FATAL", format, args...);
105 template <
typename... Args>
108 fatal(format, args...);
112 template <
typename... Args>
113 inline void _log(FILE* fs,
const char* name,
const char* format,
const Args&...
args)
115 std::stringstream ss;
116 ss <<
"[mavrosflight][" << name <<
"]: " << format << std::endl;
118 #pragma GCC diagnostic push 119 #pragma GCC diagnostic ignored "-Wformat-security" 120 fprintf(fs, ss.str().c_str(), args...);
121 #pragma GCC diagnostic pop 126 #endif // MAVROSFLIGHT_DEFAULT_LOGGER_H void error(const char *format, const Args &...args)
void debug(const char *format, const Args &...args)
void info_throttle(float period, const char *format, const Args &...args)
Default logger that outputs to stdout and stderr. Throttling is ignored to reduce timing complexity...
void _log(FILE *fs, const char *name, const char *format, const Args &...args)
void info(const char *format, const Args &...args)
Abstract base class for message handler.
void warn(const char *format, const Args &...args)
void debug_throttle(float period, const char *format, const Args &...args)
void fatal(const char *format, const Args &...args)
void fatal_throttle(float period, const char *format, const Args &...args)
void error_throttle(float period, const char *format, const Args &...args)
void warn_throttle(float period, const char *format, const Args &...args)