Skip to content

Commit

Permalink
#56 better formatting of file log
Browse files Browse the repository at this point in the history
  • Loading branch information
carmenfan committed Mar 31, 2016
1 parent c9cad02 commit 299373c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bouncer/src/repo/lib/repo_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void RepoLog::log(

}

BOOST_LOG_ATTRIBUTE_KEYWORD(timestamp, "TimeStamp", boost::posix_time::ptime)
BOOST_LOG_ATTRIBUTE_KEYWORD(threadid, "ThreadID", boost::log::attributes::current_thread_id::value_type)
void RepoLog::logToFile(const std::string &filePath)
{

Expand All @@ -68,9 +70,15 @@ void RepoLog::logToFile(const std::string &filePath)
boost::log::keywords::file_name = filePath + "_%N",
boost::log::keywords::rotation_size = 10 * 1024 * 1024,
boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(0, 0, 0),
boost::log::keywords::format = "[%TimeStamp%]: %Message%"
boost::log::keywords::format = (
boost::log::expressions::stream
<< "[" << boost::log::expressions::format_date_time(timestamp, "%Y-%m-%d %H:%M:%S") << "]"
<< "(" << threadid << ")"
<< ": <" << boost::log::trivial::severity
<< "> " << boost::log::expressions::smessage
) ,
);

boost::log::add_common_attributes();
}

void RepoLog::setLoggingLevel(const RepoLogLevel &level)
Expand Down

0 comments on commit 299373c

Please sign in to comment.