File size: 1,784 Bytes
bfd87b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#pragma once

#include <aws/core/Core_EXPORTS.h>
#include <aws/core/utils/logging/LogLevel.h>
#include <aws/common/logging.h>

#include <atomic>

namespace Aws
{
    namespace Utils
    {
        namespace Logging
        {
            enum class LogLevel : int;

            /**
             * Interface for CRT (common runtime libraries) logging implementations.
             * A wrapper on the top of aws_logger, the logging interface used by common runtime libraries.
             */
            class AWS_CORE_API CRTLogSystemInterface
            {
            public:
                virtual ~CRTLogSystemInterface() = default;

                /**
                 * Gets the currently configured log level.
                 */
                virtual LogLevel GetLogLevel() const = 0;
                /**
                 * Set a new log level. This has the immediate effect of changing the log output to the new level.
                 */
                virtual void SetLogLevel(LogLevel logLevel) = 0;

                /**
                 * Handle the logging information from common runtime libraries.
                 * Redirect them to C++ SDK logging system by default.
                 */
                virtual void Log(LogLevel logLevel, const char* subjectName, const char* formatStr, va_list args) = 0;

                /**
                 * Wrapper on top of CRT's aws_logger::clean_up method.
                 */
                virtual void CleanUp() {return;}
            };
        } // namespace Logging
    } // namespace Utils
} // namespace Aws

// for backward compatibility
#include <aws/core/utils/logging/DefaultCRTLogSystem.h>