aws-crt-cpp
Api.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License").
6  * You may not use this file except in compliance with the License.
7  * A copy of the License is located at
8  *
9  * http://aws.amazon.com/apache2.0
10  *
11  * or in the "license" file accompanying this file. This file is distributed
12  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16 #include <aws/crt/Types.h>
17 #include <aws/crt/io/Bootstrap.h>
19 #include <aws/crt/io/TlsOptions.h>
21 
22 #include <aws/common/logging.h>
23 
24 namespace Aws
25 {
26  namespace Crt
27  {
28  enum class LogLevel
29  {
30  None = AWS_LL_NONE,
31  Fatal = AWS_LL_FATAL,
32  Error = AWS_LL_ERROR,
33  Warn = AWS_LL_WARN,
34  Info = AWS_LL_INFO,
35  Debug = AWS_LL_DEBUG,
36  Trace = AWS_LL_TRACE,
37 
38  Count
39  };
40 
42  {
43  public:
44  ApiHandle(Allocator *allocator) noexcept;
45  ApiHandle() noexcept;
46  ~ApiHandle();
47  ApiHandle(const ApiHandle &) = delete;
48  ApiHandle(ApiHandle &&) = delete;
49  ApiHandle &operator=(const ApiHandle &) = delete;
50  ApiHandle &operator=(ApiHandle &&) = delete;
57  void InitializeLogging(LogLevel level, const char *filename);
64  void InitializeLogging(LogLevel level, FILE *fp);
65 
66  private:
67  void InitializeLoggingCommon(struct aws_logger_standard_options &options);
68 
69  aws_logger logger;
70  };
71 
72  AWS_CRT_CPP_API const char *ErrorDebugString(int error) noexcept;
76  AWS_CRT_CPP_API int LastError() noexcept;
81  AWS_CRT_CPP_API int LastErrorOrUnknown() noexcept;
82  } // namespace Crt
83 } // namespace Aws
Aws::Crt::ApiHandle::ApiHandle
ApiHandle(const ApiHandle &)=delete
Aws::Crt::Allocator
aws_allocator Allocator
Definition: StlAllocator.h:25
Aws::Crt::LogLevel::Fatal
@ Fatal
Aws::Crt::ApiHandle::operator=
ApiHandle & operator=(ApiHandle &&)=delete
Aws::Crt::LogLevel::Error
@ Error
EventLoopGroup.h
Types.h
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition: Exports.h:34
Aws::Crt::ApiHandle::operator=
ApiHandle & operator=(const ApiHandle &)=delete
Aws::Crt::LogLevel::Trace
@ Trace
TlsOptions.h
Bootstrap.h
error
Definition: cJSON.cpp:84
Aws::Crt::LastError
AWS_CRT_CPP_API int LastError() noexcept
Definition: Api.cpp:116
Aws::Crt::LogLevel::Warn
@ Warn
Aws::Crt::LogLevel::Debug
@ Debug
MqttClient.h
Aws::Crt::LogLevel::Info
@ Info
Aws::Crt::ErrorDebugString
AWS_CRT_CPP_API const char * ErrorDebugString(int error) noexcept
Definition: Api.cpp:114
Aws::Crt::LastErrorOrUnknown
AWS_CRT_CPP_API int LastErrorOrUnknown() noexcept
Definition: Api.cpp:118
Aws
Definition: Api.h:25
Aws::Crt::LogLevel::None
@ None
Aws::Crt::ApiHandle::ApiHandle
ApiHandle(ApiHandle &&)=delete
Aws::Crt::LogLevel
LogLevel
Definition: Api.h:29
Aws::Crt::LogLevel::Count
@ Count
Aws::Crt::ApiHandle
Definition: Api.h:42