mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 17:42:40 -06:00
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
This commit is contained in:
parent
98e9f4c32e
commit
8f51dd9513
6 changed files with 37 additions and 18 deletions
|
@ -84,6 +84,7 @@ add_library(citra_common STATIC
|
||||||
logging/filter.h
|
logging/filter.h
|
||||||
logging/formatter.h
|
logging/formatter.h
|
||||||
logging/log.h
|
logging/log.h
|
||||||
|
logging/log_entry.h
|
||||||
logging/text_formatter.cpp
|
logging/text_formatter.cpp
|
||||||
logging/text_formatter.h
|
logging/text_formatter.h
|
||||||
logging/types.h
|
logging/types.h
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_paths.h"
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <share.h> // For _SH_DENYWR
|
#include <share.h> // For _SH_DENYWR
|
||||||
#include <windows.h> // For OutputDebugStringW
|
#include <windows.h> // For OutputDebugStringW
|
||||||
|
@ -22,12 +24,14 @@
|
||||||
#define CITRA_LINUX_GCC_BACKTRACE
|
#define CITRA_LINUX_GCC_BACKTRACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "common/common_paths.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/literals.h"
|
#include "common/literals.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "common/logging/log_entry.h"
|
||||||
#include "common/logging/text_formatter.h"
|
#include "common/logging/text_formatter.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/threadsafe_queue.h"
|
#include "common/threadsafe_queue.h"
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include "common/logging/formatter.h"
|
#include "common/logging/formatter.h"
|
||||||
#include "common/logging/types.h"
|
#include "common/logging/types.h"
|
||||||
|
|
||||||
|
|
28
src/common/logging/log_entry.h
Normal file
28
src/common/logging/log_entry.h
Normal file
|
@ -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 <chrono>
|
||||||
|
|
||||||
|
#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
|
|
@ -15,6 +15,7 @@
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/logging/filter.h"
|
#include "common/logging/filter.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "common/logging/log_entry.h"
|
||||||
#include "common/logging/text_formatter.h"
|
#include "common/logging/text_formatter.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Common::Log {
|
namespace Common::Log {
|
||||||
|
@ -105,19 +103,4 @@ enum class Class : u8 {
|
||||||
Count ///< Total number of logging classes
|
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
|
} // namespace Common::Log
|
||||||
|
|
Loading…
Reference in a new issue