Merge pull request #3847 from NarcolepticK/ir-migrate-logging
service/ir: Migrate logging macros
This commit is contained in:
		| @@ -165,8 +165,8 @@ void ExtraHID::OnDisconnect() { | ||||
|  | ||||
| void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) { | ||||
|     if (request.size() != 3) { | ||||
|         LOG_ERROR(Service_IR, "Wrong request size (%zu): %s", request.size(), | ||||
|                   Common::ArrayToString(request.data(), request.size()).c_str()); | ||||
|         NGLOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(), | ||||
|                     Common::ArrayToString(request.data(), request.size())); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -187,8 +187,8 @@ void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_b | ||||
|                   "ReadCalibrationDataRequest has wrong size"); | ||||
|  | ||||
|     if (request_buf.size() != sizeof(ReadCalibrationDataRequest)) { | ||||
|         LOG_ERROR(Service_IR, "Wrong request size (%zu): %s", request_buf.size(), | ||||
|                   Common::ArrayToString(request_buf.data(), request_buf.size()).c_str()); | ||||
|         NGLOG_ERROR(Service_IR, "Wrong request size ({}): {}", request_buf.size(), | ||||
|                     Common::ArrayToString(request_buf.data(), request_buf.size())); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -199,8 +199,8 @@ void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_b | ||||
|     const u16 size = Common::AlignDown(request.size, 16); | ||||
|  | ||||
|     if (offset + size > calibration_data.size()) { | ||||
|         LOG_ERROR(Service_IR, "Read beyond the end of calibration data! (offset=%u, size=%u)", | ||||
|                   offset, size); | ||||
|         NGLOG_ERROR(Service_IR, "Read beyond the end of calibration data! (offset={}, size={})", | ||||
|                     offset, size); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -222,8 +222,8 @@ void ExtraHID::OnReceive(const std::vector<u8>& data) { | ||||
|         HandleReadCalibrationDataRequest(data); | ||||
|         break; | ||||
|     default: | ||||
|         LOG_ERROR(Service_IR, "Unknown request: %s", | ||||
|                   Common::ArrayToString(data.data(), data.size()).c_str()); | ||||
|         NGLOG_ERROR(Service_IR, "Unknown request: {}", | ||||
|                     Common::ArrayToString(data.data(), data.size())); | ||||
|         break; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -122,7 +122,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) { | ||||
|     raw_c_stick = rp.Pop<bool>(); | ||||
|  | ||||
|     if (raw_c_stick) | ||||
|         LOG_ERROR(Service_IR, "raw C-stick data is not implemented!"); | ||||
|         NGLOG_ERROR(Service_IR, "raw C-stick data is not implemented!"); | ||||
|  | ||||
|     next_pad_index = 0; | ||||
|     is_device_reload_pending.store(true); | ||||
| @@ -131,7 +131,7 @@ void IR_RST::Initialize(Kernel::HLERequestContext& ctx) { | ||||
|     IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|  | ||||
|     LOG_DEBUG(Service_IR, "called. update_period=%d, raw_c_stick=%d", update_period, raw_c_stick); | ||||
|     NGLOG_DEBUG(Service_IR, "called. update_period={}, raw_c_stick={}", update_period, raw_c_stick); | ||||
| } | ||||
|  | ||||
| void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) { | ||||
| @@ -142,7 +142,7 @@ void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) { | ||||
|  | ||||
|     IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|     LOG_DEBUG(Service_IR, "called"); | ||||
|     NGLOG_DEBUG(Service_IR, "called"); | ||||
| } | ||||
|  | ||||
| IR_RST::IR_RST() : ServiceFramework("ir:rst", 1) { | ||||
|   | ||||
| @@ -183,8 +183,8 @@ private: | ||||
|  | ||||
| /// Wraps the payload into packet and puts it to the receive buffer | ||||
| void IR_USER::PutToReceive(const std::vector<u8>& payload) { | ||||
|     LOG_TRACE(Service_IR, "called, data=%s", | ||||
|               Common::ArrayToString(payload.data(), payload.size()).c_str()); | ||||
|     NGLOG_TRACE(Service_IR, "called, data={}", | ||||
|                 Common::ArrayToString(payload.data(), payload.size())); | ||||
|     size_t size = payload.size(); | ||||
|  | ||||
|     std::vector<u8> packet; | ||||
| @@ -225,7 +225,7 @@ void IR_USER::PutToReceive(const std::vector<u8>& payload) { | ||||
|     if (receive_buffer->Put(packet)) { | ||||
|         receive_event->Signal(); | ||||
|     } else { | ||||
|         LOG_ERROR(Service_IR, "receive buffer is full!"); | ||||
|         NGLOG_ERROR(Service_IR, "receive buffer is full!"); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -251,12 +251,12 @@ void IR_USER::InitializeIrNopShared(Kernel::HLERequestContext& ctx) { | ||||
|  | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|  | ||||
|     LOG_INFO(Service_IR, | ||||
|              "called, shared_buff_size=%u, recv_buff_size=%u, " | ||||
|              "recv_buff_packet_count=%u, send_buff_size=%u, " | ||||
|              "send_buff_packet_count=%u, baud_rate=%u", | ||||
|              shared_buff_size, recv_buff_size, recv_buff_packet_count, send_buff_size, | ||||
|              send_buff_packet_count, baud_rate); | ||||
|     NGLOG_INFO(Service_IR, | ||||
|                "called, shared_buff_size={}, recv_buff_size={}, " | ||||
|                "recv_buff_packet_count={}, send_buff_size={}, " | ||||
|                "send_buff_packet_count={}, baud_rate={}", | ||||
|                shared_buff_size, recv_buff_size, recv_buff_packet_count, send_buff_size, | ||||
|                send_buff_packet_count, baud_rate); | ||||
| } | ||||
|  | ||||
| void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) { | ||||
| @@ -275,7 +275,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) { | ||||
|         connected_device->OnConnect(); | ||||
|         conn_status_event->Signal(); | ||||
|     } else { | ||||
|         LOG_WARNING(Service_IR, "unknown device id %u. Won't connect.", device_id); | ||||
|         NGLOG_WARNING(Service_IR, "unknown device id {}. Won't connect.", device_id); | ||||
|         shared_memory_ptr[offsetof(SharedMemoryHeader, connection_status)] = 1; | ||||
|         shared_memory_ptr[offsetof(SharedMemoryHeader, trying_to_connect_status)] = 2; | ||||
|     } | ||||
| @@ -283,7 +283,7 @@ void IR_USER::RequireConnection(Kernel::HLERequestContext& ctx) { | ||||
|     IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|  | ||||
|     LOG_INFO(Service_IR, "called, device_id = %u", device_id); | ||||
|     NGLOG_INFO(Service_IR, "called, device_id = {}", device_id); | ||||
| } | ||||
|  | ||||
| void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) { | ||||
| @@ -292,7 +292,7 @@ void IR_USER::GetReceiveEvent(Kernel::HLERequestContext& ctx) { | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|     rb.PushCopyObjects(receive_event); | ||||
|  | ||||
|     LOG_INFO(Service_IR, "called"); | ||||
|     NGLOG_INFO(Service_IR, "called"); | ||||
| } | ||||
|  | ||||
| void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) { | ||||
| @@ -301,7 +301,7 @@ void IR_USER::GetSendEvent(Kernel::HLERequestContext& ctx) { | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|     rb.PushCopyObjects(send_event); | ||||
|  | ||||
|     LOG_INFO(Service_IR, "called"); | ||||
|     NGLOG_INFO(Service_IR, "called"); | ||||
| } | ||||
|  | ||||
| void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) { | ||||
| @@ -318,7 +318,7 @@ void IR_USER::Disconnect(Kernel::HLERequestContext& ctx) { | ||||
|     IPC::RequestBuilder rb(ctx, 0x09, 1, 0); | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|  | ||||
|     LOG_INFO(Service_IR, "called"); | ||||
|     NGLOG_INFO(Service_IR, "called"); | ||||
| } | ||||
|  | ||||
| void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) { | ||||
| @@ -327,7 +327,7 @@ void IR_USER::GetConnectionStatusEvent(Kernel::HLERequestContext& ctx) { | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|     rb.PushCopyObjects(conn_status_event); | ||||
|  | ||||
|     LOG_INFO(Service_IR, "called"); | ||||
|     NGLOG_INFO(Service_IR, "called"); | ||||
| } | ||||
|  | ||||
| void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) { | ||||
| @@ -342,7 +342,7 @@ void IR_USER::FinalizeIrNop(Kernel::HLERequestContext& ctx) { | ||||
|     IPC::RequestBuilder rb(ctx, 0x02, 1, 0); | ||||
|     rb.Push(RESULT_SUCCESS); | ||||
|  | ||||
|     LOG_INFO(Service_IR, "called"); | ||||
|     NGLOG_INFO(Service_IR, "called"); | ||||
| } | ||||
|  | ||||
| void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) { | ||||
| @@ -357,12 +357,12 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) { | ||||
|         send_event->Signal(); | ||||
|         rb.Push(RESULT_SUCCESS); | ||||
|     } else { | ||||
|         LOG_ERROR(Service_IR, "not connected"); | ||||
|         NGLOG_ERROR(Service_IR, "not connected"); | ||||
|         rb.Push(ResultCode(static_cast<ErrorDescription>(13), ErrorModule::IR, | ||||
|                            ErrorSummary::InvalidState, ErrorLevel::Status)); | ||||
|     } | ||||
|  | ||||
|     LOG_TRACE(Service_IR, "called, data=%s", Common::ArrayToString(buffer.data(), size).c_str()); | ||||
|     NGLOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(buffer.data(), size)); | ||||
| } | ||||
|  | ||||
| void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) { | ||||
| @@ -374,12 +374,12 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) { | ||||
|     if (receive_buffer->Release(count)) { | ||||
|         rb.Push(RESULT_SUCCESS); | ||||
|     } else { | ||||
|         LOG_ERROR(Service_IR, "failed to release %u packets", count); | ||||
|         NGLOG_ERROR(Service_IR, "failed to release {} packets", count); | ||||
|         rb.Push(ResultCode(ErrorDescription::NoData, ErrorModule::IR, ErrorSummary::NotFound, | ||||
|                            ErrorLevel::Status)); | ||||
|     } | ||||
|  | ||||
|     LOG_TRACE(Service_IR, "called, count=%u", count); | ||||
|     NGLOG_TRACE(Service_IR, "called, count={}", count); | ||||
| } | ||||
|  | ||||
| IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Weiyi Wang
					Weiyi Wang