new log class: "logState"

This commit is contained in:
badaix 2016-02-08 16:04:53 +01:00
parent a4e501c960
commit a759911474
5 changed files with 40 additions and 17 deletions

View file

@ -111,9 +111,7 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
throw SnapException("codec not supported: \"" + headerChunk_->codec + "\""); throw SnapException("codec not supported: \"" + headerChunk_->codec + "\"");
sampleFormat_ = decoder_->setHeader(headerChunk_.get()); sampleFormat_ = decoder_->setHeader(headerChunk_.get());
logO << "sample rate: " << sampleFormat_.rate << "Hz\n"; logState << "sampleformat: " << sampleFormat_.rate << ":" << sampleFormat_.bits << ":" << sampleFormat_.channels << "\n";
logO << "bits/sample: " << sampleFormat_.bits << "\n";
logO << "channels : " << sampleFormat_.channels << "\n";
stream_.reset(new Stream(sampleFormat_)); stream_.reset(new Stream(sampleFormat_));
stream_->setBufferLen(serverSettings_->bufferMs - latency_); stream_->setBufferLen(serverSettings_->bufferMs - latency_);

View file

@ -1,11 +1,25 @@
snapclient (0.5.0-beta-1) unstable; urgency=low snapclient (0.5.0~beta-1) unstable; urgency=low
* Features * Features
-TODO -Remote control API (JSON)
Get server status, get streams, get active clients
assign volume, assign stream, rename client, ...
-Android port of the Snapclient with a remote control app
-Multiple streams ("zones") can be configured using "-s, --stream":
The stream is configured by an URI: path, name, codec, sample format, ...
E.g. "pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac"
or "file:///home/user/some_pcm_file.wav?name=file"
-Added .default file for the service (/etc/default/snapserver).
Default program options should be configured here (e.g. streams)
* Bugfixes * Bugfixes
-TODO -pipe reader recovers if the pipe has been reopened
* General * General
-TODO -SnapCast is renamed to Snapcast
SnapClient => Snapclient
SnapServer => Snapserver
-Snapcast protocol:
Less messaging: SampleFormat, Command, Ack, String, not yet final
-Removed dependency to boost
-- Johannes Pohl <johannes.pohl@badaix.de> Tue, 29 Dec 2015 12:00:00 +0200 -- Johannes Pohl <johannes.pohl@badaix.de> Tue, 29 Dec 2015 12:00:00 +0200

View file

@ -54,11 +54,13 @@ int Log::sync()
#endif #endif
else if (priority_ == kOut) else if (priority_ == kOut)
std::cout << Timestamp() << " [out] " << buffer_.str() << std::flush; std::cout << Timestamp() << " [out] " << buffer_.str() << std::flush;
else if (priority_ == kState)
std::cout << Timestamp() << " [state] " << buffer_.str() << std::flush;
else if (priority_ == kErr) else if (priority_ == kErr)
std::cout << Timestamp() << " [err] " << buffer_.str() << std::flush; std::cout << Timestamp() << " [err] " << buffer_.str() << std::flush;
else else
{ {
std::cout << Timestamp() << " [" << priority_ << "] " << buffer_.str() << std::flush; std::cout << Timestamp() << " [" << (int)priority_ << "] " << buffer_.str() << std::flush;
syslog(priority_, "%s", buffer_.str().c_str()); syslog(priority_, "%s", buffer_.str().c_str());
} }
buffer_.str(""); buffer_.str("");

View file

@ -28,6 +28,7 @@
#define logD std::clog << kDbg #define logD std::clog << kDbg
#define logO std::clog << kOut #define logO std::clog << kOut
#define logE std::clog << kErr #define logE std::clog << kErr
#define logState std::clog << kState
#define logS(P) std::clog << P #define logS(P) std::clog << P
#define log logO #define log logO
@ -41,7 +42,7 @@ enum LogPriority
kLogNotice = LOG_NOTICE, // normal, but significant, condition kLogNotice = LOG_NOTICE, // normal, but significant, condition
kLogInfo = LOG_INFO, // informational message kLogInfo = LOG_INFO, // informational message
kLogDebug = LOG_DEBUG, // debug-level message kLogDebug = LOG_DEBUG, // debug-level message
kDbg, kOut, kErr kDbg, kOut, kState, kErr
}; };
std::ostream& operator<< (std::ostream& os, const LogPriority& log_priority); std::ostream& operator<< (std::ostream& os, const LogPriority& log_priority);

View file

@ -1,16 +1,24 @@
snapserver (0.5.0-beta-1) unstable; urgency=low snapserver (0.5.0~beta-1) unstable; urgency=low
* Features * Features
-Added .default file -Remote control API (JSON)
-Remote control API (JSON) Get server status, get streams, get active clients
-Android Snapclient with remote control assign volume, assign stream, rename client, ...
-PCM reader is configured by URI: path, name, codec, sample format, ... -Android port of the Snapclient with a remote control app
-Multiple streams ("zones") can be configured using "-s, --stream":
The stream is configured by an URI: path, name, codec, sample format, ...
E.g. "pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac"
or "file:///home/user/some_pcm_file.wav?name=file"
-Added .default file for the service (/etc/default/snapserver).
Default program options should be configured here (e.g. streams)
* Bugfixes * Bugfixes
-TODO -pipe reader recovers if the pipe has been reopened
* General * General
-SnapCast is renamed to Snapcast, SnapClient => Snapclient, SnapServer => Snapserver -SnapCast is renamed to Snapcast
SnapClient => Snapclient
SnapServer => Snapserver
-Snapcast protocol: -Snapcast protocol:
Less messaging: SampleFormat, Command, Ack, String Less messaging: SampleFormat, Command, Ack, String, not yet final
-Removed dependency to boost -Removed dependency to boost
-- Johannes Pohl <johannes.pohl@badaix.de> Tue, 29 Dec 2015 12:00:00 +0200 -- Johannes Pohl <johannes.pohl@badaix.de> Tue, 29 Dec 2015 12:00:00 +0200