AWS SDK for C++

AWS SDK for C++ Version 1.11.606

Loading...
Searching...
No Matches
DefaultLogSystem.h
1
6#pragma once
7
8#include <aws/core/Core_EXPORTS.h>
9
10#include <aws/core/utils/logging/FormattedLogSystem.h>
11#include <aws/core/utils/logging/LogLevel.h>
12#include <aws/core/utils/memory/stl/AWSVector.h>
13#include <aws/core/utils/memory/stl/AWSString.h>
14#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
15
16#include <thread>
17#include <memory>
18#include <mutex>
19#include <atomic>
20#include <condition_variable>
21
22namespace Aws
23{
24 namespace Utils
25 {
26 namespace Logging
27 {
32 class AWS_CORE_API DefaultLogSystem : public FormattedLogSystem
33 {
34 public:
36
40 DefaultLogSystem(LogLevel logLevel, const std::shared_ptr<Aws::OStream>& logFile);
45 DefaultLogSystem(LogLevel logLevel, const Aws::String& filenamePrefix);
46
48
53 void Flush() override;
54
58 void Stop() override;
59
64 {
65 public:
66 LogSynchronizationData() : m_stopLogging(false), m_loggingThreadStopped(false) {}
67
68 std::mutex m_logQueueMutex;
69 std::condition_variable m_queueSignal;
71 bool m_stopLogging = false;
72 bool m_loggingThreadStopped = false;
73
74 private:
76 LogSynchronizationData& operator =(const LogSynchronizationData& rhs) = delete;
77 };
78
79 protected:
83 virtual void ProcessFormattedStatement(Aws::String&& statement) override;
84
85 private:
86 DefaultLogSystem(const DefaultLogSystem& rhs) = delete;
87 DefaultLogSystem& operator =(const DefaultLogSystem& rhs) = delete;
88
89 LogSynchronizationData m_syncData;
90
91 std::thread m_loggingThread;
92 };
93
94 } // namespace Logging
95 } // namespace Utils
96} // namespace Aws
DefaultLogSystem(LogLevel logLevel, const std::shared_ptr< Aws::OStream > &logFile)
virtual void ProcessFormattedStatement(Aws::String &&statement) override
DefaultLogSystem(LogLevel logLevel, const Aws::String &filenamePrefix)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition AWSString.h:97
std::vector< T, Aws::Allocator< T > > Vector
Definition AWSVector.h:17