This commit is contained in:
Erik Frojdh 2020-03-03 17:01:45 +01:00
parent 1efacc9475
commit 3431752649
4 changed files with 37 additions and 9 deletions

View File

@ -17,7 +17,8 @@ Checks: '*,
-google-runtime-references, -google-runtime-references,
-google-readability-todo, -google-readability-todo,
-google-readability-braces-around-statements, -google-readability-braces-around-statements,
-modernize-use-trailing-return-type' -modernize-use-trailing-return-type,
-readability-isolate-declaration'
HeaderFilterRegex: \.h HeaderFilterRegex: \.h
AnalyzeTemporaryDtors: false AnalyzeTemporaryDtors: false

View File

@ -5,7 +5,7 @@
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <unistd.h> #include <unistd.h>
#include <iostream>
#ifdef FIFODEBUG #ifdef FIFODEBUG
@ -22,8 +22,8 @@
#endif #endif
#define STRINGIFY(x) #x // #define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x) // #define TOSTRING(x) STRINGIFY(x)
#define MYCONCAT(x,y) #define MYCONCAT(x,y)
#define __AT__ std::string(__FILE__) + std::string("::") + std::string(__func__) + std::string("(): ") #define __AT__ std::string(__FILE__) + std::string("::") + std::string(__func__) + std::string("(): ")
#define __SHORT_FORM_OF_FILE__ \ #define __SHORT_FORM_OF_FILE__ \
@ -162,13 +162,23 @@ inline FILE*& Output2FILE::Stream()
return pStream; return pStream;
} }
// inline void Output2FILE::Output(const std::string& msg)
// {
// FILE* pStream = Stream();
// if (!pStream)
// return;
// fprintf(pStream, "%s", msg.c_str());
// fflush(pStream);
// }
inline void Output2FILE::Output(const std::string& msg) inline void Output2FILE::Output(const std::string& msg)
{ {
FILE* pStream = Stream(); std::cout << msg;
if (!pStream) // FILE* pStream = Stream();
return; // if (!pStream)
fprintf(pStream, "%s", msg.c_str()); // return;
fflush(pStream); // fprintf(pStream, "%s", msg.c_str());
// fflush(pStream);
} }
inline void Output2FILE::Output(const std::string& msg, TLogLevel level) inline void Output2FILE::Output(const std::string& msg, TLogLevel level)

View File

@ -9,4 +9,5 @@ target_sources(tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test-ToString.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-ToString.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-logger.cpp
) )

View File

@ -0,0 +1,16 @@
#include "catch.hpp"
#include "logger.h"
#include <iostream>
#include <fstream>
TEST_CASE("fail"){
FILE_LOG(logINFO) << "A message";
// CHECK(false);
}