diff --git a/bcos-utilities/BoostLogInitializer.h b/bcos-utilities/BoostLogInitializer.h index 3651f85..b79da1a 100644 --- a/bcos-utilities/BoostLogInitializer.h +++ b/bcos-utilities/BoostLogInitializer.h @@ -35,6 +35,8 @@ #include #include #include +#include +#include namespace bcos { @@ -95,7 +97,15 @@ class BoostLogInitializer { try { - auto formatter = boost::log::parse_formatter(format); + // replace ~ with %, because only % is used as escape character in boost log + std::string realFormat(format); + char toReplace = '~'; + char replacement = '%'; + std::replace_if( + realFormat.begin(), realFormat.end(), + [&toReplace](char c) { return c == toReplace; }, replacement); + + auto formatter = boost::log::parse_formatter(realFormat); _sink->set_formatter(formatter); } catch (std::exception& e) diff --git a/cmake/CompilerSettings.cmake b/cmake/CompilerSettings.cmake index 17c9e73..989aae8 100644 --- a/cmake/CompilerSettings.cmake +++ b/cmake/CompilerSettings.cmake @@ -40,7 +40,6 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR("${CMAKE_CXX_COMPILER_ID}" MATC add_compile_options(-Wno-unused-variable) add_compile_options(-Wno-unknown-pragmas) add_compile_options(-Wno-deprecated-declarations) - add_compile_options(-Wno-error=deprecated-declarations) add_compile_options(-fno-omit-frame-pointer) add_compile_options(-Wno-error=strict-aliasing)