diff --git a/src/debug.cpp b/src/debug.cpp index 111423418..2d5ad8449 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -366,6 +366,24 @@ void debug_file_dump(const char *key, void (*serialize)(const void *data, FILE * } #endif +/** + * @brief prints the error with the advice to report the bug + * + * @param msg the message to be printed, can be prefixed with particular + * MOD_NAME. Should end with either ' ' or '\n' (what fits the caller better). + */ +void +bug_msg(int level, const char *msg) +{ + log_msg(level, + "%sPlease report a bug" +#ifdef PACKAGE_BUGREPORT + " to " PACKAGE_BUGREPORT +#endif // defined PACKAGE_BUGREPORT + " if you reach here.\n", + msg); +} + Log_output::Log_output(){ last_msg.reserve(initial_buf_size); interactive = color_output_init(); diff --git a/src/debug.h b/src/debug.h index 6de8df3fe..5fb57aade 100644 --- a/src/debug.h +++ b/src/debug.h @@ -101,6 +101,8 @@ bool parse_log_cfg(const char *conf_str, bool *logger_skip_repeats, enum log_timestamp_mode *show_timestamps); +void bug_msg(int level, const char *msg); + #ifdef __cplusplus } #endif diff --git a/src/host.h b/src/host.h index 45770ab8f..0ea30945c 100644 --- a/src/host.h +++ b/src/host.h @@ -72,8 +72,6 @@ * of module was successful but no state was created (eg. when driver had displayed help). */ #define INIT_NOERR ((void*)1) // NOLINT (cppcoreguidelines-pro-type-cstyle-cast) -#define BUG_MSG "Please report a bug to " PACKAGE_BUGREPORT " if you reach here." - #ifdef __cplusplus extern "C" { #endif diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index 7684242ac..e06f22e17 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -334,7 +334,8 @@ static struct video_desc vidcap_dshow_get_video_desc(AM_MEDIA_TYPE *mediaType) desc.fps = 10000000.0/infoHeader->AvgTimePerFrame; if (infoHeader->dwInterlaceFlags & AMINTERLACE_IsInterlaced) { if (infoHeader->dwInterlaceFlags & AMINTERLACE_1FieldPerSample) { - LOG(LOG_LEVEL_WARNING) << MOD_NAME "1 Field Per Sample is not supported! " BUG_MSG "\n"; + bug_msg(LOG_LEVEL_WARNING, MOD_NAME + "1 Field Per Sample is not supported! "); } else { desc.interlacing = INTERLACED_MERGED; }