export log formatter.
This commit is contained in:
parent
c845c037ef
commit
46836a2d5f
44
.gitignore
vendored
Normal file
44
.gitignore
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# C++ objects and libs
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.a
|
||||
*.la
|
||||
*.lai
|
||||
*.so
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
object_script.*.Release
|
||||
object_script.*.Debug
|
||||
*_plugin_import.cpp
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.moc
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
*.qmlc
|
||||
*.jsc
|
||||
Makefile*
|
||||
*build-*
|
||||
|
||||
# Qt unit tests
|
||||
target_wrapper.*
|
||||
|
||||
# QtCreator
|
||||
*.autosave
|
||||
|
||||
# QtCreator Qml
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
|
||||
# QtCreator CMake
|
||||
CMakeLists.txt.user*
|
||||
|
||||
build
|
@ -7,12 +7,10 @@
|
||||
#include "AndroidBoostLog.h"
|
||||
#endif
|
||||
|
||||
static void logFormatter(boost::log::record_view const &record, boost::log::formatting_ostream &ostream);
|
||||
|
||||
BOOST_LOG_GLOBAL_LOGGER_INIT(location_logger, LocationLogger<boost::log::trivial::severity_level>) {
|
||||
LocationLogger<boost::log::trivial::severity_level> lg;
|
||||
auto consoleSink = boost::log::add_console_log();
|
||||
consoleSink->set_formatter(&logFormatter);
|
||||
consoleSink->set_formatter(&boost::log::defaultFormatter);
|
||||
boost::log::add_common_attributes();
|
||||
return lg;
|
||||
}
|
||||
@ -35,15 +33,13 @@ void initialize(const std::string &filename, const std::string &target, boost::l
|
||||
oss << filename << "_%Y-%m-%d_%H.%M.%S_%N.log";
|
||||
auto fileSink =
|
||||
add_file_log(keywords::file_name = oss.str(), keywords::auto_flush = true, keywords::target = target);
|
||||
fileSink->set_formatter(&logFormatter);
|
||||
fileSink->set_formatter(&defaultFormatter);
|
||||
#endif
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
} // namespace log
|
||||
} // namespace boost
|
||||
|
||||
static void logFormatter(const boost::log::record_view &record, boost::log::formatting_ostream &ostream) {
|
||||
void defaultFormatter(const boost::log::record_view &record, boost::log::formatting_ostream &ostream) {
|
||||
using namespace boost::log;
|
||||
|
||||
std::string level;
|
||||
@ -70,3 +66,6 @@ static void logFormatter(const boost::log::record_view &record, boost::log::form
|
||||
// Finally, put the record message to the stream
|
||||
ostream << record[expressions::smessage];
|
||||
}
|
||||
|
||||
} // namespace log
|
||||
} // namespace boost
|
||||
|
@ -64,6 +64,8 @@ namespace log {
|
||||
*/
|
||||
void initialize(const std::string &filename = "logs/app", const std::string &target = "logs",
|
||||
trivial::severity_level filter = static_cast<trivial::severity_level>(LOG_FILTER_LEVEL));
|
||||
|
||||
void defaultFormatter(boost::log::record_view const &record, boost::log::formatting_ostream &ostream);
|
||||
} // namespace log
|
||||
} // namespace boost
|
||||
|
||||
|
2
resource/deploy.sh
Normal file → Executable file
2
resource/deploy.sh
Normal file → Executable file
@ -3,7 +3,7 @@
|
||||
base_path=$(pwd)
|
||||
qt_prefix_path="/opt/Qt/6.6.1/gcc_64"
|
||||
libraries_root="/opt/Libraries"
|
||||
if [ $base_path == /home/* ] || [ -n "${DRONE}" ]; then
|
||||
if [ $base_path==/home/* ]; then
|
||||
build_path=${base_path}/build
|
||||
else
|
||||
build_path=/tmp/build
|
||||
|
Loading…
Reference in New Issue
Block a user