From 5daf3abe65bb168e4274049c26e7f309b8f10e82 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 30 Sep 2021 16:11:47 -0400 Subject: [PATCH 1/2] common/logging: Move Log::Entry declaration to a separate header This reduces the load of requiring to include std::chrono in all files which include log.h --- src/audio_core/command_generator.cpp | 3 ++ src/audio_core/mix_context.cpp | 2 ++ src/audio_core/voice_context.cpp | 2 ++ src/common/CMakeLists.txt | 1 + src/common/logging/backend.cpp | 3 ++ src/common/logging/log.h | 4 +++ src/common/logging/log_entry.h | 28 +++++++++++++++++++ src/common/logging/text_formatter.cpp | 1 + src/common/logging/types.h | 17 ----------- .../hle/kernel/k_auto_object_container.cpp | 2 ++ src/core/hle/service/lbl/lbl.cpp | 1 + src/video_core/engines/maxwell_3d.h | 1 + 12 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 src/common/logging/log_entry.h diff --git a/src/audio_core/command_generator.cpp b/src/audio_core/command_generator.cpp index 45b2eef522..830af46ad2 100644 --- a/src/audio_core/command_generator.cpp +++ b/src/audio_core/command_generator.cpp @@ -2,13 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include + #include "audio_core/algorithm/interpolate.h" #include "audio_core/command_generator.h" #include "audio_core/effect_context.h" #include "audio_core/mix_context.h" #include "audio_core/voice_context.h" +#include "common/common_types.h" #include "core/memory.h" namespace AudioCore { diff --git a/src/audio_core/mix_context.cpp b/src/audio_core/mix_context.cpp index 4bca72eb03..057aab5add 100644 --- a/src/audio_core/mix_context.cpp +++ b/src/audio_core/mix_context.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include + #include "audio_core/behavior_info.h" #include "audio_core/common.h" #include "audio_core/effect_context.h" diff --git a/src/audio_core/voice_context.cpp b/src/audio_core/voice_context.cpp index d8c954b603..75012a887f 100644 --- a/src/audio_core/voice_context.cpp +++ b/src/audio_core/voice_context.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include + #include "audio_core/behavior_info.h" #include "audio_core/voice_context.h" #include "core/memory.h" diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index b18a2a2f50..cb5c0f3267 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -79,6 +79,7 @@ add_library(common STATIC logging/filter.cpp logging/filter.h logging/log.h + logging/log_entry.h logging/text_formatter.cpp logging/text_formatter.h logging/types.h diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index e40d117d64..0e85a9c1de 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -9,6 +9,8 @@ #include #include +#include + #ifdef _WIN32 #include // For OutputDebugStringW #endif @@ -22,6 +24,7 @@ #include "common/logging/backend.h" #include "common/logging/log.h" +#include "common/logging/log_entry.h" #include "common/logging/text_formatter.h" #include "common/settings.h" #ifdef _WIN32 diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 8d43eddc76..34fd2c30bc 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -4,7 +4,11 @@ #pragma once +#include +#include + #include + #include "common/logging/types.h" namespace Common::Log { diff --git a/src/common/logging/log_entry.h b/src/common/logging/log_entry.h new file mode 100644 index 0000000000..dd6f448418 --- /dev/null +++ b/src/common/logging/log_entry.h @@ -0,0 +1,28 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include + +#include "common/logging/types.h" + +namespace Common::Log { + +/** + * A log entry. Log entries are store in a structured format to permit more varied output + * formatting on different frontends, as well as facilitating filtering and aggregation. + */ +struct Entry { + std::chrono::microseconds timestamp; + Class log_class{}; + Level log_level{}; + const char* filename = nullptr; + unsigned int line_num = 0; + std::string function; + std::string message; + bool final_entry = false; +}; + +} // namespace Common::Log diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index cfc0d5846a..10b2281db1 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -13,6 +13,7 @@ #include "common/common_funcs.h" #include "common/logging/filter.h" #include "common/logging/log.h" +#include "common/logging/log_entry.h" #include "common/logging/text_formatter.h" #include "common/string_util.h" diff --git a/src/common/logging/types.h b/src/common/logging/types.h index ddf9d27caf..2d21fc483b 100644 --- a/src/common/logging/types.h +++ b/src/common/logging/types.h @@ -4,8 +4,6 @@ #pragma once -#include - #include "common/common_types.h" namespace Common::Log { @@ -131,19 +129,4 @@ enum class Class : u8 { Count ///< Total number of logging classes }; -/** - * A log entry. Log entries are store in a structured format to permit more varied output - * formatting on different frontends, as well as facilitating filtering and aggregation. - */ -struct Entry { - std::chrono::microseconds timestamp; - Class log_class{}; - Level log_level{}; - const char* filename = nullptr; - unsigned int line_num = 0; - std::string function; - std::string message; - bool final_entry = false; -}; - } // namespace Common::Log diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp index 010006bb70..d5f80d5b26 100644 --- a/src/core/hle/kernel/k_auto_object_container.cpp +++ b/src/core/hle/kernel/k_auto_object_container.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include + #include "core/hle/kernel/k_auto_object_container.h" namespace Kernel { diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index 24890c8302..37ff372771 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include "common/logging/log.h" diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 7f4ca6282f..f22342dfb8 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include From 579f4ea4bd34f310fc8e60a4c154981a86727686 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 30 Sep 2021 20:59:49 -0400 Subject: [PATCH 2/2] common/logging: Reduce scope of fmt include --- src/common/logging/log.h | 2 +- src/common/param_package.cpp | 1 + .../hle/service/time/system_clock_context_update_callback.h | 1 + src/core/hle/service/time/system_clock_core.h | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 34fd2c30bc..c186d55ef6 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include "common/logging/types.h" diff --git a/src/common/param_package.cpp b/src/common/param_package.cpp index b916b48668..bbf20f5ebc 100644 --- a/src/common/param_package.cpp +++ b/src/common/param_package.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include #include diff --git a/src/core/hle/service/time/system_clock_context_update_callback.h b/src/core/hle/service/time/system_clock_context_update_callback.h index 7979549582..6936397a5d 100644 --- a/src/core/hle/service/time/system_clock_context_update_callback.h +++ b/src/core/hle/service/time/system_clock_context_update_callback.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "core/hle/service/time/clock_types.h" diff --git a/src/core/hle/service/time/system_clock_core.h b/src/core/hle/service/time/system_clock_core.h index 83d0e5d62f..b9237ad284 100644 --- a/src/core/hle/service/time/system_clock_core.h +++ b/src/core/hle/service/time/system_clock_core.h @@ -4,6 +4,8 @@ #pragma once +#include + #include "common/common_types.h" #include "core/hle/service/time/clock_types.h"