AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
WebSocketSDKLogger.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETSDKLOGGER_H_
17 #define ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETSDKLOGGER_H_
18 
19 #include <websocketpp/common/cpp11.hpp>
20 #include <websocketpp/logger/levels.hpp>
21 #include <string>
22 
23 namespace alexaClientSDK {
24 namespace sampleApplications {
25 namespace ipcServerSampleApp {
26 namespace communication {
29 public:
30  using level = websocketpp::log::level;
31 
33 
36  WebSocketSDKLogger(websocketpp::log::channel_type_hint::value hint = websocketpp::log::channel_type_hint::access) :
37  m_channelTypeHint{hint} {
38  }
39 
41 
45  WebSocketSDKLogger(level channels, websocketpp::log::channel_type_hint::value hint) : m_channelTypeHint{hint} {
46  }
47 
49 
54  void set_channels(level channels) {
55  }
56 
58 
63  void clear_channels(level channels) {
64  }
65 
67 
73  bool static_test(level channel) const {
74  return true;
75  }
76 
78 
84  bool dynamic_test(level channel) const {
85  return true;
86  }
87 
89 
93  void write(level channel, std::string const& msg);
94 
96 
100  void write(level channel, char const* msg);
101 
102 private:
104 
108  void logErrorMessage(level channel, char const* msg) const;
109 
111 
115  void logAccessMessage(level, char const* msg) const;
116 
117  websocketpp::log::channel_type_hint::value m_channelTypeHint;
118 };
119 } // namespace communication
120 } // namespace ipcServerSampleApp
121 } // namespace sampleApplications
122 } // namespace alexaClientSDK
123 
124 #endif // ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETSDKLOGGER_H_
WebSocketSDKLogger(websocketpp::log::channel_type_hint::value hint=websocketpp::log::channel_type_hint::access)
Construct the logger.
Definition: WebSocketSDKLogger.h:36
::std::string string
Definition: gtest-port.h:1097
void set_channels(level channels)
Dynamically enable the given list of channels.
Definition: WebSocketSDKLogger.h:54
void clear_channels(level channels)
Dynamically disable the given list of channels.
Definition: WebSocketSDKLogger.h:63
Wrapper around the Alexa Client SDK logger for use by websocketspp.
Definition: WebSocketSDKLogger.h:28
WebSocketSDKLogger(level channels, websocketpp::log::channel_type_hint::value hint)
Construct the logger.
Definition: WebSocketSDKLogger.h:45
void write(level channel, std::string const &msg)
Write a string message to the given channel.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
bool static_test(level channel) const
Tests whether a log level is statically enabled.
Definition: WebSocketSDKLogger.h:73
bool dynamic_test(level channel) const
Tests whether a log level is dynamically enabled.
Definition: WebSocketSDKLogger.h:84
websocketpp::log::level level
Definition: WebSocketSDKLogger.h:30

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0