1 // Copyright 2023 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14
15 #define PW_LOG_MODULE_NAME "PW_RPC"
16
17 #include <cstddef>
18
19 #include "pw_log/log.h"
20 #include "pw_status/status.h"
21
22 namespace pw::rpc::internal {
23
LogNoRpcServiceRegistryError()24 void LogNoRpcServiceRegistryError() {
25 PW_LOG_ERROR("LocalRpcEgress: service registry not configured");
26 }
27
LogPacketSizeTooLarge(size_t packet_size,size_t max_packet_size)28 void LogPacketSizeTooLarge(size_t packet_size, size_t max_packet_size) {
29 PW_LOG_ERROR("LocalRpcEgress: packet too large (%d > %d)",
30 static_cast<int>(packet_size),
31 static_cast<int>(max_packet_size));
32 }
33
LogEgressThreadNotRunningError()34 void LogEgressThreadNotRunningError() {
35 PW_LOG_ERROR("LocalRpcEgress: egress thread is not running");
36 }
37
LogFailedToProcessPacket(Status status)38 void LogFailedToProcessPacket(Status status) {
39 PW_LOG_ERROR("LocalRpcEgress: failed to process packet. Status %d",
40 static_cast<int>(status.code()));
41 }
42
LogFailedToAccessPacket(Status status)43 void LogFailedToAccessPacket(Status status) {
44 PW_LOG_ERROR("LocalRpcEgress: failed to access packet buffer. Status %d",
45 static_cast<int>(status.code()));
46 }
47
LogNoPacketAvailable(Status status)48 void LogNoPacketAvailable(Status status) {
49 PW_LOG_ERROR("LocalRpcEgress: no packet available. Status %d",
50 static_cast<int>(status.code()));
51 }
52
53 } // namespace pw::rpc::internal
54