sampleFormat

git-svn-id: svn://elaine/murooma/trunk@205 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-08-23 11:40:23 +00:00
parent d4fcf84fb8
commit e7803a2c11
13 changed files with 176 additions and 157 deletions

View file

@ -11,7 +11,10 @@ Log::Log(std::string ident, int facility) {
int Log::sync() {
if (buffer_.length()) {
syslog(priority_, buffer_.c_str());
if (priority_ == dbg)
std::cout << buffer_.c_str();
else
syslog(priority_, "%s", buffer_.c_str());
buffer_.erase();
priority_ = LOG_DEBUG; // default to debug for each message
}
@ -29,6 +32,8 @@ int Log::overflow(int c) {
std::ostream& operator<< (std::ostream& os, const LogPriority& log_priority) {
static_cast<Log *>(os.rdbuf())->priority_ = (int)log_priority;
if (log_priority == dbg)
os.flush();
return os;
}