summaryrefslogtreecommitdiff
path: root/src/common/logging
diff options
context:
space:
mode:
authorGravatar bunnei2021-10-05 10:05:46 -0700
committerGravatar GitHub2021-10-05 10:05:46 -0700
commit5b2fa8dd418d82b51acdc6849fafbc6a2e858fa9 (patch)
tree879f5fb79a0d320cb56a5e66eab783de9614d88a /src/common/logging
parentMerge pull request #7103 from Morph1984/service-ctx-event (diff)
parentcommon/logging: Reduce scope of fmt include (diff)
downloadyuzu-5b2fa8dd418d82b51acdc6849fafbc6a2e858fa9.tar.gz
yuzu-5b2fa8dd418d82b51acdc6849fafbc6a2e858fa9.tar.xz
yuzu-5b2fa8dd418d82b51acdc6849fafbc6a2e858fa9.zip
Merge pull request #7115 from ameerj/log-compile
common/logging: Reduce dependent header include overhead
Diffstat (limited to 'src/common/logging')
-rw-r--r--src/common/logging/backend.cpp3
-rw-r--r--src/common/logging/log.h6
-rw-r--r--src/common/logging/log_entry.h28
-rw-r--r--src/common/logging/text_formatter.cpp1
-rw-r--r--src/common/logging/types.h17
5 files changed, 37 insertions, 18 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index e40d117d6..0e85a9c1d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -9,6 +9,8 @@
9#include <thread> 9#include <thread>
10#include <vector> 10#include <vector>
11 11
12#include <fmt/format.h>
13
12#ifdef _WIN32 14#ifdef _WIN32
13#include <windows.h> // For OutputDebugStringW 15#include <windows.h> // For OutputDebugStringW
14#endif 16#endif
@@ -22,6 +24,7 @@
22 24
23#include "common/logging/backend.h" 25#include "common/logging/backend.h"
24#include "common/logging/log.h" 26#include "common/logging/log.h"
27#include "common/logging/log_entry.h"
25#include "common/logging/text_formatter.h" 28#include "common/logging/text_formatter.h"
26#include "common/settings.h" 29#include "common/settings.h"
27#ifdef _WIN32 30#ifdef _WIN32
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 8d43eddc7..c186d55ef 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -4,7 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <fmt/format.h> 7#include <algorithm>
8#include <string_view>
9
10#include <fmt/core.h>
11
8#include "common/logging/types.h" 12#include "common/logging/types.h"
9 13
10namespace Common::Log { 14namespace Common::Log {
diff --git a/src/common/logging/log_entry.h b/src/common/logging/log_entry.h
new file mode 100644
index 000000000..dd6f44841
--- /dev/null
+++ b/src/common/logging/log_entry.h
@@ -0,0 +1,28 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <chrono>
8
9#include "common/logging/types.h"
10
11namespace Common::Log {
12
13/**
14 * A log entry. Log entries are store in a structured format to permit more varied output
15 * formatting on different frontends, as well as facilitating filtering and aggregation.
16 */
17struct Entry {
18 std::chrono::microseconds timestamp;
19 Class log_class{};
20 Level log_level{};
21 const char* filename = nullptr;
22 unsigned int line_num = 0;
23 std::string function;
24 std::string message;
25 bool final_entry = false;
26};
27
28} // namespace Common::Log
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index cfc0d5846..10b2281db 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -13,6 +13,7 @@
13#include "common/common_funcs.h" 13#include "common/common_funcs.h"
14#include "common/logging/filter.h" 14#include "common/logging/filter.h"
15#include "common/logging/log.h" 15#include "common/logging/log.h"
16#include "common/logging/log_entry.h"
16#include "common/logging/text_formatter.h" 17#include "common/logging/text_formatter.h"
17#include "common/string_util.h" 18#include "common/string_util.h"
18 19
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index ddf9d27ca..2d21fc483 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -4,8 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <chrono>
8
9#include "common/common_types.h" 7#include "common/common_types.h"
10 8
11namespace Common::Log { 9namespace Common::Log {
@@ -131,19 +129,4 @@ enum class Class : u8 {
131 Count ///< Total number of logging classes 129 Count ///< Total number of logging classes
132}; 130};
133 131
134/**
135 * A log entry. Log entries are store in a structured format to permit more varied output
136 * formatting on different frontends, as well as facilitating filtering and aggregation.
137 */
138struct Entry {
139 std::chrono::microseconds timestamp;
140 Class log_class{};
141 Level log_level{};
142 const char* filename = nullptr;
143 unsigned int line_num = 0;
144 std::string function;
145 std::string message;
146 bool final_entry = false;
147};
148
149} // namespace Common::Log 132} // namespace Common::Log