mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-04 00:59:32 +02:00
update logger
This commit is contained in:
parent
2955b20e9d
commit
ce55f15c02
36 changed files with 967 additions and 389 deletions
|
@ -44,7 +44,7 @@ void PublishAvahi::publish(const std::vector<mDNSService>& services)
|
|||
if (!(simple_poll = avahi_simple_poll_new()))
|
||||
{
|
||||
///TODO: error handling
|
||||
logE << "Failed to create simple poll object.\n";
|
||||
LOG(ERROR) << "Failed to create simple poll object.\n";
|
||||
}
|
||||
|
||||
/// Allocate a new client
|
||||
|
@ -54,7 +54,7 @@ void PublishAvahi::publish(const std::vector<mDNSService>& services)
|
|||
/// Check wether creating the client object succeeded
|
||||
if (!client_)
|
||||
{
|
||||
logE << "Failed to create client: " << avahi_strerror(error) << "\n";
|
||||
LOG(ERROR) << "Failed to create client: " << avahi_strerror(error) << "\n";
|
||||
}
|
||||
|
||||
active_ = true;
|
||||
|
@ -93,7 +93,7 @@ void PublishAvahi::entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState
|
|||
{
|
||||
case AVAHI_ENTRY_GROUP_ESTABLISHED :
|
||||
/// The entry group has been established successfully
|
||||
logO << "Service '" << name << "' successfully established.\n";
|
||||
LOG(INFO) << "Service '" << name << "' successfully established.\n";
|
||||
break;
|
||||
|
||||
case AVAHI_ENTRY_GROUP_COLLISION :
|
||||
|
@ -105,7 +105,7 @@ void PublishAvahi::entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState
|
|||
avahi_free(name);
|
||||
name = n;
|
||||
|
||||
logO << "Service name collision, renaming service to '" << name << "'\n";
|
||||
LOG(NOTICE) << "Service name collision, renaming service to '" << name << "'\n";
|
||||
|
||||
/// And recreate the services
|
||||
static_cast<PublishAvahi*>(userdata)->create_services(avahi_entry_group_get_client(g));
|
||||
|
@ -114,7 +114,7 @@ void PublishAvahi::entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState
|
|||
|
||||
case AVAHI_ENTRY_GROUP_FAILURE :
|
||||
|
||||
logE << "Entry group failure: " << avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))) << "\n";
|
||||
LOG(ERROR) << "Entry group failure: " << avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))) << "\n";
|
||||
|
||||
/// Some kind of failure happened while we were registering our services
|
||||
avahi_simple_poll_quit(simple_poll);
|
||||
|
@ -136,7 +136,7 @@ void PublishAvahi::create_services(AvahiClient *c)
|
|||
{
|
||||
if (!(group = avahi_entry_group_new(c, entry_group_callback, this)))
|
||||
{
|
||||
logE << "avahi_entry_group_new() failed: " << avahi_strerror(avahi_client_errno(c)) << "\n";
|
||||
LOG(ERROR) << "avahi_entry_group_new() failed: " << avahi_strerror(avahi_client_errno(c)) << "\n";
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void PublishAvahi::create_services(AvahiClient *c)
|
|||
int ret;
|
||||
if (avahi_entry_group_is_empty(group))
|
||||
{
|
||||
logO << "Adding service '" << name << "'\n";
|
||||
LOG(INFO) << "Adding service '" << name << "'\n";
|
||||
|
||||
/// We will now add two services and one subtype to the entry group
|
||||
for (const auto& service: services_)
|
||||
|
@ -155,7 +155,7 @@ void PublishAvahi::create_services(AvahiClient *c)
|
|||
if (ret == AVAHI_ERR_COLLISION)
|
||||
goto collision;
|
||||
|
||||
logE << "Failed to add " << service.name_ << " service: " << avahi_strerror(ret) << "\n";
|
||||
LOG(ERROR) << "Failed to add " << service.name_ << " service: " << avahi_strerror(ret) << "\n";
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void PublishAvahi::create_services(AvahiClient *c)
|
|||
/// Tell the server to register the service
|
||||
if ((ret = avahi_entry_group_commit(group)) < 0)
|
||||
{
|
||||
logE << "Failed to commit entry group: " << avahi_strerror(ret) << "\n";
|
||||
LOG(ERROR) << "Failed to commit entry group: " << avahi_strerror(ret) << "\n";
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ collision:
|
|||
avahi_free(name);
|
||||
name = n;
|
||||
|
||||
logO << "Service name collision, renaming service to '" << name << "'\n";
|
||||
LOG(INFO) << "Service name collision, renaming service to '" << name << "'\n";
|
||||
|
||||
avahi_entry_group_reset(group);
|
||||
|
||||
|
@ -211,7 +211,7 @@ void PublishAvahi::client_callback(AvahiClient *c, AvahiClientState state, AVAHI
|
|||
|
||||
case AVAHI_CLIENT_FAILURE:
|
||||
|
||||
logE << "Client failure: " << avahi_strerror(avahi_client_errno(c)) << "\n";
|
||||
LOG(ERROR) << "Client failure: " << avahi_strerror(avahi_client_errno(c)) << "\n";
|
||||
avahi_simple_poll_quit(simple_poll);
|
||||
break;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void PublishBonjour::worker()
|
|||
DNSServiceErrorType err = DNSServiceProcessResult(clients[n]);
|
||||
if (err)
|
||||
{
|
||||
logE << "DNSServiceProcessResult returned " << err << "\n";
|
||||
LOG(ERROR) << "DNSServiceProcessResult returned " << err << "\n";
|
||||
active_ = false;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void PublishBonjour::worker()
|
|||
// myTimerCallBack();
|
||||
else if (result < 0)
|
||||
{
|
||||
logE << "select() returned " << result << " errno " << errno << " " << strerror(errno) << "\n";
|
||||
LOG(ERROR) << "select() returned " << result << " errno " << errno << " " << strerror(errno) << "\n";
|
||||
if (errno != EINTR)
|
||||
active_ = false;
|
||||
}
|
||||
|
@ -116,23 +116,23 @@ static void DNSSD_API reg_reply(DNSServiceRef sdref, const DNSServiceFlags flags
|
|||
PublishBonjour* publishBonjour = (PublishBonjour*)context;
|
||||
(void)publishBonjour; // unused
|
||||
|
||||
logO << "Got a reply for service " << name << "." << regtype << domain << "\n";
|
||||
LOG(INFO) << "Got a reply for service " << name << "." << regtype << domain << "\n";
|
||||
|
||||
if (errorCode == kDNSServiceErr_NoError)
|
||||
{
|
||||
if (flags & kDNSServiceFlagsAdd)
|
||||
logO << "Name now registered and active\n";
|
||||
LOG(INFO) << "Name now registered and active\n";
|
||||
else
|
||||
logO << "Name registration removed\n";
|
||||
LOG(INFO) << "Name registration removed\n";
|
||||
}
|
||||
else if (errorCode == kDNSServiceErr_NameConflict)
|
||||
{
|
||||
/// TODO: Error handling
|
||||
logO << "Name in use, please choose another\n";
|
||||
LOG(INFO) << "Name in use, please choose another\n";
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
logO << "Error " << errorCode << "\n";
|
||||
LOG(INFO) << "Error " << errorCode << "\n";
|
||||
|
||||
if (!(flags & kDNSServiceFlagsMoreComing))
|
||||
fflush(stdout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue