#include "logger.hpp"

namespace nlsr {

string
Logger::getEpochTime()
{
  std::stringstream ss;
  boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970, 1, 1));
  boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
  boost::posix_time::time_duration diff = now - time_t_epoch;
  ss << diff.total_seconds() << "." << boost::format("%06i") %
     (diff.total_microseconds()
      % 1000000);
  return ss.str();
}

string
Logger::getUserHomeDirectory()
{
  string homeDirPath(getpwuid(getuid())->pw_dir);
  if (homeDirPath.empty())
  {
    homeDirPath = getenv("HOME");
  }
  return homeDirPath;
}

void
Logger::initialize(std::string dirPath)
{
  string logDirPath(dirPath);
  if (dirPath.empty())
  {
    logDirPath = getUserHomeDirectory() + "/nlsrLog";
  }
  cout << "Log Dir Path: " << logDirPath << endl;
  typedef sinks::synchronous_sink<sinks::text_file_backend> file_sink;
  shared_ptr<file_sink> sink(new file_sink(
                               keywords::file_name = logDirPath
                                                     + "/NLSR%Y%m%d%H%M%S_%3N.log",
                               keywords::rotation_size = 16 * 1024 * 1024,
                               keywords::time_based_rotation = sinks::file::rotation_at_time_point(12, 0, 0),
                               keywords::auto_flush = true
                             ));
  sink->locked_backend()->set_file_collector(sinks::file::make_collector(
                                               keywords::target = logDirPath,
                                               //keywords::max_size =  512 * 1024 * 1024,
                                               keywords::min_free_space = 64 * 1024 * 1024
                                             ));
  sink->set_formatter(
    expr::format("%1% %2%")
    % getEpochTime()
    % expr::smessage
  );
  logging::core::get()->add_sink(sink);
}

}//namespace nlsr
