Merge pull request #3859 from NarcolepticK/sm-migrate-logging

service/sm: Migrate logging macros
This commit is contained in:
Weiyi Wang 2018-06-22 11:47:34 +03:00 committed by GitHub
commit 274859b8ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,7 @@ void SRV::RegisterClient(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_SRV, "(STUBBED) called"); NGLOG_WARNING(Service_SRV, "(STUBBED) called");
} }
/** /**
@ -67,7 +67,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(notification_semaphore); rb.PushCopyObjects(notification_semaphore);
LOG_WARNING(Service_SRV, "(STUBBED) called"); NGLOG_WARNING(Service_SRV, "(STUBBED) called");
} }
/** /**
@ -92,7 +92,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
if (name_len > Service::kMaxPortSize) { if (name_len > Service::kMaxPortSize) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_INVALID_NAME_SIZE); rb.Push(ERR_INVALID_NAME_SIZE);
LOG_ERROR(Service_SRV, "called name_len=0x%zX -> ERR_INVALID_NAME_SIZE", name_len); NGLOG_ERROR(Service_SRV, "called name_len=0x{:X} -> ERR_INVALID_NAME_SIZE", name_len);
return; return;
} }
std::string name(name_buf.data(), name_len); std::string name(name_buf.data(), name_len);
@ -103,25 +103,24 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
if (client_port.Failed()) { if (client_port.Failed()) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(client_port.Code()); rb.Push(client_port.Code());
LOG_ERROR(Service_SRV, "called service=%s -> error 0x%08X", name.c_str(), NGLOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name,
client_port.Code().raw); client_port.Code().raw);
return; return;
} }
auto session = client_port.Unwrap()->Connect(); auto session = client_port.Unwrap()->Connect();
if (session.Succeeded()) { if (session.Succeeded()) {
LOG_DEBUG(Service_SRV, "called service=%s -> session=%u", name.c_str(), NGLOG_DEBUG(Service_SRV, "called service={} -> session={}", name,
(*session)->GetObjectId()); (*session)->GetObjectId());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(session.Code()); rb.Push(session.Code());
rb.PushMoveObjects(std::move(session).Unwrap()); rb.PushMoveObjects(std::move(session).Unwrap());
} else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) { } else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) {
LOG_WARNING(Service_SRV, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED", name.c_str()); NGLOG_WARNING(Service_SRV, "called service={} -> ERR_MAX_CONNECTIONS_REACHED", name);
// TODO(Subv): Put the caller guest thread to sleep until this port becomes available again. // TODO(Subv): Put the caller guest thread to sleep until this port becomes available again.
UNIMPLEMENTED_MSG("Unimplemented wait until port {} is available.", name); UNIMPLEMENTED_MSG("Unimplemented wait until port {} is available.", name);
} else { } else {
LOG_ERROR(Service_SRV, "called service=%s -> error 0x%08X", name.c_str(), NGLOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name, session.Code().raw);
session.Code().raw);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(session.Code()); rb.Push(session.Code());
} }
@ -142,7 +141,7 @@ void SRV::Subscribe(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x%X", notification_id); NGLOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}", notification_id);
} }
/** /**
@ -160,7 +159,7 @@ void SRV::Unsubscribe(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x%X", notification_id); NGLOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}", notification_id);
} }
/** /**
@ -180,8 +179,8 @@ void SRV::PublishToSubscriber(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x%X, flags=%u", notification_id, NGLOG_WARNING(Service_SRV, "(STUBBED) called, notification_id=0x{:X}, flags={}",
flags); notification_id, flags);
} }
void SRV::RegisterService(Kernel::HLERequestContext& ctx) { void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
@ -198,7 +197,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
if (port.Failed()) { if (port.Failed()) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(port.Code()); rb.Push(port.Code());
LOG_ERROR(Service_SRV, "called service=%s -> error 0x%08X", name.c_str(), port.Code().raw); NGLOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name, port.Code().raw);
return; return;
} }