mirror of
https://github.com/KjellKod/g3log.git
synced 2025-03-01 10:57:57 +01:00
Merge pull request #129 from AbberiorInstruments/msvc-format-specifier
MSVC printf format specifier
This commit is contained in:
commit
813e3da1f9
@ -16,6 +16,9 @@
|
||||
#include <sstream>
|
||||
#include <cstdarg>
|
||||
#include <csignal>
|
||||
#ifdef _MSC_VER
|
||||
# include <sal.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Simple struct for capturing log/fatal entries. At destruction the captured message is
|
||||
@ -49,8 +52,17 @@ struct LogCapture {
|
||||
// Ref: http://www.unixwiz.net/techtips/gnu-c-attributes.html
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x) // Disable 'attributes' if compiler does not support 'em
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
# if _MSC_VER >= 1400
|
||||
# define G3LOG_FORMAT_STRING _Printf_format_string_
|
||||
# else
|
||||
# define G3LOG_FORMAT_STRING __format_string
|
||||
# endif
|
||||
#else
|
||||
# define G3LOG_FORMAT_STRING
|
||||
#endif
|
||||
void capturef(const char *printf_like_message, ...) __attribute__((format(printf, 2, 3))); // 2,3 ref: http://www.codemaestro.com/reviews/18
|
||||
void capturef(G3LOG_FORMAT_STRING const char *printf_like_message, ...) __attribute__((format(printf, 2, 3))); // 2,3 ref: http://www.codemaestro.com/reviews/18
|
||||
|
||||
|
||||
/// prettifying API for this completely open struct
|
||||
|
Loading…
x
Reference in New Issue
Block a user