Logging API changes
Remove would_log() : callbacks receive all log messages so they can do custom filtering individually. Also move popup message handling into the private (d-ptr) of sglog(), to keep the header as minimal impossible (no include of <vector>)
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include <simgear/debug/debug_types.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
// forward decls
|
||||
@@ -93,8 +92,6 @@ public:
|
||||
*/
|
||||
void setLogLevels( sgDebugClass c, sgDebugPriority p );
|
||||
|
||||
bool would_log( sgDebugClass c, sgDebugPriority p ) const;
|
||||
|
||||
void logToFile( const SGPath& aPath, sgDebugClass c, sgDebugPriority p );
|
||||
|
||||
void set_log_priority( sgDebugPriority p);
|
||||
@@ -179,8 +176,6 @@ private:
|
||||
// constructor
|
||||
logstream();
|
||||
|
||||
std::vector<std::string> popup_msgs;
|
||||
|
||||
class LogStreamPrivate;
|
||||
|
||||
std::unique_ptr<LogStreamPrivate> d;
|
||||
@@ -197,17 +192,17 @@ logstream& sglog();
|
||||
* @param M message
|
||||
*/
|
||||
# define SG_LOGX(C,P,M) \
|
||||
do { if(sglog().would_log(C,P)) { \
|
||||
do { \
|
||||
std::ostringstream os; os << M; \
|
||||
sglog().log(C, P, __FILE__, __LINE__, os.str()); \
|
||||
if ((P) == SG_POPUP) sglog().popup(os.str()); \
|
||||
} } while(0)
|
||||
} while(0)
|
||||
#ifdef FG_NDEBUG
|
||||
# define SG_LOG(C,P,M) do { if((P) == SG_POPUP) SG_LOGX(C,P,M) } while(0)
|
||||
# define SG_HEXDUMP(C,P,MEM,LEN)
|
||||
#else
|
||||
# define SG_LOG(C,P,M) SG_LOGX(C,P,M)
|
||||
# define SG_LOG_HEXDUMP(C,P,MEM,LEN) if(sglog().would_log(C,P)) sglog().hexdump(C, P, __FILE__, __LINE__, MEM, LEN)
|
||||
# define SG_LOG_HEXDUMP(C,P,MEM,LEN) sglog().hexdump(C, P, __FILE__, __LINE__, MEM, LEN)
|
||||
#endif
|
||||
|
||||
#define SG_ORIGIN __FILE__ ":" SG_STRINGIZE(__LINE__)
|
||||
|
||||
Reference in New Issue
Block a user