Split the LMS_LOG macro to work either with a ostream logger or a wt logger

This commit is contained in:
emeric
2019-11-19 18:14:23 +01:00
parent 9259ec19e1
commit b69e0c0c3d
32 changed files with 282 additions and 88 deletions
+4
View File
@@ -9,6 +9,7 @@
#include "av/AvInfo.hpp"
#include "metadata/AvFormat.hpp"
#include "metadata/TagLibParser.hpp"
#include "utils/StreamLogger.hpp"
std::ostream& operator<<(std::ostream& os, const MetaData::Artist& artist)
{
@@ -124,6 +125,9 @@ int main(int argc, char *argv[])
try
{
// log to stdout
ServiceProvider<Logger>::create<StreamLogger>(std::cout);
for (std::size_t i {}; i < static_cast<std::size_t>(argc - 1); ++i)
{
std::filesystem::path file {argv[i + 1]};
+1
View File
@@ -6,6 +6,7 @@ lms_metadata_SOURCES = \
$(top_srcdir)/src/metadata/AvFormat.cpp \
$(top_srcdir)/src/metadata/TagLibParser.cpp \
$(top_srcdir)/src/utils/Logger.cpp \
$(top_srcdir)/src/utils/StreamLogger.cpp \
$(top_srcdir)/src/utils/Utils.cpp
lms_metadata_CXXFLAGS=-std=c++17 -I$(top_srcdir)/src -D_REENTRANT
@@ -6,19 +6,23 @@
#include "database/Db.hpp"
#include "utils/Config.hpp"
#include "utils/Service.hpp"
#include "utils/StreamLogger.hpp"
int main(int argc, char *argv[])
{
try
{
// log to stdout
ServiceProvider<Logger>::create<StreamLogger>(std::cout);
std::filesystem::path configFilePath {"/etc/lms.conf"};
if (argc >= 2)
configFilePath = std::string(argv[1], 0, 256);
ServiceProvider<Config>::create(configFilePath);
Database::Db db {getService<Config>()->getPath("working-dir") / "lms.db"};
Database::Db db {ServiceProvider<Config>::get()->getPath("working-dir") / "lms.db"};
auto session {db.createSession()};
/* const FeatureSettings
+1
View File
@@ -18,6 +18,7 @@ lms_similarity_parameters_SOURCES = \
$(top_srcdir)/src/similarity/features/som/Network.cpp \
$(top_srcdir)/src/utils/Config.cpp \
$(top_srcdir)/src/utils/Logger.cpp \
$(top_srcdir)/src/utils/StreamLogger.cpp \
$(top_srcdir)/src/utils/Utils.cpp
lms_similarity_parameters_CXXFLAGS=-std=c++17 -I$(top_srcdir)/src -D_REENTRANT
+5 -1
View File
@@ -7,6 +7,7 @@
#include "database/Session.hpp"
#include "utils/Config.hpp"
#include "utils/Service.hpp"
#include "utils/StreamLogger.hpp"
#include "similarity/features/SimilarityFeaturesSearcher.hpp"
int main(int argc, char *argv[])
@@ -15,6 +16,9 @@ int main(int argc, char *argv[])
{
using namespace Similarity;
// log to stdout
ServiceProvider<Logger>::create<StreamLogger>(std::cout);
const FeatureSettingsMap featuresSettings
{
// { "lowlevel.average_loudness", 1 },
@@ -34,7 +38,7 @@ int main(int argc, char *argv[])
ServiceProvider<Config>::create(configFilePath);
Database::Db db {getService<Config>()->getPath("working-dir") / "lms.db"};
Database::Db db {ServiceProvider<Config>::get()->getPath("working-dir") / "lms.db"};
auto session {db.createSession()};
std::cout << "Getting all features..." << std::endl;
+1
View File
@@ -21,6 +21,7 @@ lms_similarity_SOURCES = \
$(top_srcdir)/src/similarity/features/SimilarityFeaturesDefs.cpp \
$(top_srcdir)/src/utils/Config.cpp \
$(top_srcdir)/src/utils/Logger.cpp \
$(top_srcdir)/src/utils/StreamLogger.cpp \
$(top_srcdir)/src/utils/Utils.cpp
lms_similarity_CXXFLAGS=-std=c++17 -I$(top_srcdir)/src -D_REENTRANT