mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-15 08:00:05 +00:00
logging/backend: Make use of designated initializers
Same behavior, less code.
This commit is contained in:
parent
ca2d87e5e3
commit
4fd0cbebdb
@ -107,19 +107,19 @@ private:
|
|||||||
Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr,
|
Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr,
|
||||||
const char* function, std::string message) const {
|
const char* function, std::string message) const {
|
||||||
using std::chrono::duration_cast;
|
using std::chrono::duration_cast;
|
||||||
|
using std::chrono::microseconds;
|
||||||
using std::chrono::steady_clock;
|
using std::chrono::steady_clock;
|
||||||
|
|
||||||
Entry entry;
|
return {
|
||||||
entry.timestamp =
|
.timestamp = duration_cast<microseconds>(steady_clock::now() - time_origin),
|
||||||
duration_cast<std::chrono::microseconds>(steady_clock::now() - time_origin);
|
.log_class = log_class,
|
||||||
entry.log_class = log_class;
|
.log_level = log_level,
|
||||||
entry.log_level = log_level;
|
.filename = filename,
|
||||||
entry.filename = filename;
|
.line_num = line_nr,
|
||||||
entry.line_num = line_nr;
|
.function = function,
|
||||||
entry.function = function;
|
.message = std::move(message),
|
||||||
entry.message = std::move(message);
|
.final_entry = false,
|
||||||
|
};
|
||||||
return entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::mutex writing_mutex;
|
std::mutex writing_mutex;
|
||||||
|
@ -20,19 +20,13 @@ namespace Log {
|
|||||||
*/
|
*/
|
||||||
struct Entry {
|
struct Entry {
|
||||||
std::chrono::microseconds timestamp;
|
std::chrono::microseconds timestamp;
|
||||||
Class log_class;
|
Class log_class{};
|
||||||
Level log_level;
|
Level log_level{};
|
||||||
const char* filename;
|
const char* filename = nullptr;
|
||||||
unsigned int line_num;
|
unsigned int line_num = 0;
|
||||||
std::string function;
|
std::string function;
|
||||||
std::string message;
|
std::string message;
|
||||||
bool final_entry = false;
|
bool final_entry = false;
|
||||||
|
|
||||||
Entry() = default;
|
|
||||||
Entry(Entry&& o) = default;
|
|
||||||
|
|
||||||
Entry& operator=(Entry&& o) = default;
|
|
||||||
Entry& operator=(const Entry& o) = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user