Commit 48d5a5f4 authored by Bart van der Velden's avatar Bart van der Velden

Attempt to log unicode characters (#65)

parent 7d62a57a
......@@ -18,10 +18,12 @@
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/chrono.hpp>
#include <boost/locale.hpp>
// Boost log
#include "boost_log_trivial.h"
#include <boost/log/core.hpp>
#include <boost/log/sinks.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
......@@ -43,15 +45,16 @@ namespace utils = mc::utils;
namespace logging = boost::log;
namespace keywords = boost::log::keywords;
namespace sinks = boost::log::sinks;
static const int Second = 1000;
static const char* DefaultLogFile = "mc";
static const char* DefaultConfigFile = "musiccollection.cfg";
static const char* CopyrightNotice = "Copyright 2012-2013 Bart van der Velden";
static const char* CopyrightNotice = "Copyright 2012-2014 Bart van der Velden";
void InitLogging(const string& logFile)
{
logging::add_file_log
boost::shared_ptr<sinks::synchronous_sink<sinks::text_file_backend > > sink = logging::add_file_log
(
keywords::file_name = logFile + ".%N" + ".log",
keywords::open_mode = ios_base::out,
......@@ -64,6 +67,8 @@ void InitLogging(const string& logFile)
(
logging::trivial::severity >= logging::trivial::info
);
std::locale loc = boost::locale::generator()("en_US.UTF-8");
sink->imbue(loc);
logging::add_common_attributes();
}
......@@ -184,7 +189,10 @@ AudioFile::AudioFile(const TagLib::FileRef& fileRef)
int len = fileRef.file()->length();
TagLib::PropertyMap pm = fileRef.file()->properties();
TagLib::String s = pm.toString();
BOOST_LOG_TRIVIAL(info) << "Properties:\n" << s.toWString();
if (s.length() > 0)
{
BOOST_LOG_TRIVIAL(info) << "Properties:\n" << s.toCString(true);
}
TagLib::FileName fn = fileRef.file()->name();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment