logging: Address some issues

This commit is contained in:
GPUCode 2023-06-24 18:30:13 +03:00
parent 9c3e2d0f50
commit ba98bf058a
11 changed files with 19 additions and 34 deletions

View file

@ -7,6 +7,7 @@
#include <atomic>
#include <condition_variable>
#include <cstddef>
#include <memory>
#include <mutex>
#include <new>
@ -94,7 +95,7 @@ private:
const size_t pos = write_index % Capacity;
// Emplace into the queue.
std::construct_at(std::addressof(m_data[pos]), std::forward<Args>(args)...);
new (std::addressof(m_data[pos])) T(std::forward<Args>(args)...);
// Increment the write index.
++m_write_index;

View file

@ -8,9 +8,9 @@
#include <memory>
#include <sstream>
#include <unordered_map>
#include <fmt/format.h>
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <fmt/format.h>
#include "common/assert.h"
#include "common/common_funcs.h"
#include "common/common_paths.h"

View file

@ -352,6 +352,9 @@ private:
lambda(static_cast<Backend&>(debugger_backend));
lambda(static_cast<Backend&>(color_console_backend));
lambda(static_cast<Backend&>(file_backend));
#ifdef ANDROID
lambda(static_cast<Backend&>(lc_backend));
#endif
}
static void Deleter(Impl* ptr) {
@ -394,6 +397,9 @@ private:
DebuggerBackend debugger_backend{};
ColorConsoleBackend color_console_backend{};
FileBackend file_backend;
#ifdef ANDROID
LogcatBackend lc_backend{};
#endif
MPSCQueue<Entry> message_queue{};
std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};

View file

@ -5,7 +5,7 @@
#pragma once
#include <type_traits>
#include <fmt/core.h>
#include <fmt/format.h>
// adapted from https://github.com/fmtlib/fmt/issues/2704
// a generic formatter for enum classes