Files
o3de/Code/Tools/AWSNativeSDKInit/include/AWSNativeSDKInit/AWSLogSystemInterface.h
T
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00

78 lines
2.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
#include <AzCore/PlatformDef.h>
AZ_PUSH_DISABLE_WARNING(4251 4996, "-Wunknown-warning-option")
#include <aws/core/utils/logging/LogSystemInterface.h>
AZ_POP_DISABLE_WARNING
#else
#include <sstream>
namespace Aws
{
using OStringStream = std::basic_ostringstream<char>;
namespace Utils
{
namespace Logging
{
using LogLevel = int;
}
}
}
#endif
namespace AWSNativeSDKInit
{
class AWSLogSystemInterface
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
: public Aws::Utils::Logging::LogSystemInterface
#endif
{
public:
static const char* AWS_API_LOG_PREFIX;
static const int MAX_MESSAGE_LENGTH;
static const char* MESSAGE_FORMAT;
static const char* ERROR_WINDOW_NAME;
static const char* LOG_ENV_VAR;
AWSLogSystemInterface(Aws::Utils::Logging::LogLevel logLevel);
/**
* Gets the currently configured log level for this logger.
*/
#if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK)
Aws::Utils::Logging::LogLevel GetLogLevel(void) const override;
#else
Aws::Utils::Logging::LogLevel GetLogLevel(void) const;
#endif
/**
* Does a printf style output to the output stream. Don't use this, it's unsafe. See LogStream
*/
void Log(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const char* formatStr, ...);
/**
* Writes the stream to the output stream.
*/
void LogStream(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream);
void Flush();
private:
bool ShouldLog(Aws::Utils::Logging::LogLevel logLevel);
void SetLogLevel(Aws::Utils::Logging::LogLevel newLevel);
void ForwardAwsApiLogMessage(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const char* message);
Aws::Utils::Logging::LogLevel m_logLevel;
};
}