use the new logger in all dll code base
This commit is contained in:
parent
26b8baefa6
commit
638eb78f0f
12
dll/base.cpp
12
dll/base.cpp
@ -18,12 +18,20 @@
|
|||||||
#include "dll/base.h"
|
#include "dll/base.h"
|
||||||
#include "dll/settings_parser.h"
|
#include "dll/settings_parser.h"
|
||||||
|
|
||||||
|
#ifndef EMU_RELEASE_BUILD
|
||||||
|
#include "dbg_log/dbg_log.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
std::recursive_mutex global_mutex{};
|
std::recursive_mutex global_mutex{};
|
||||||
// some arbitrary counter/time for reference
|
// some arbitrary counter/time for reference
|
||||||
const std::chrono::time_point<std::chrono::high_resolution_clock> startup_counter = std::chrono::high_resolution_clock::now();
|
const std::chrono::time_point<std::chrono::high_resolution_clock> startup_counter = std::chrono::high_resolution_clock::now();
|
||||||
const std::chrono::time_point<std::chrono::system_clock> startup_time = std::chrono::system_clock::now();
|
const std::chrono::time_point<std::chrono::system_clock> startup_time = std::chrono::system_clock::now();
|
||||||
|
|
||||||
|
#ifndef EMU_RELEASE_BUILD
|
||||||
|
dbg_log dbg_logger(get_full_program_path() + "STEAM_LOG.txt");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
@ -102,10 +110,6 @@ bool set_env_variable(const std::string &name, const std::string &value)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef EMU_RELEASE_BUILD
|
|
||||||
const std::string dbg_log_file = get_full_program_path() + "STEAM_LOG.txt";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned generate_account_id()
|
unsigned generate_account_id()
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
|
@ -163,6 +163,7 @@ static inline void reset_LastError()
|
|||||||
|
|
||||||
// PRINT_DEBUG definition
|
// PRINT_DEBUG definition
|
||||||
#ifndef EMU_RELEASE_BUILD
|
#ifndef EMU_RELEASE_BUILD
|
||||||
|
#include "dbg_log/dbg_log.hpp"
|
||||||
// we need this for printf specifiers for intptr_t such as PRIdPTR
|
// we need this for printf specifiers for intptr_t such as PRIdPTR
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
@ -181,21 +182,11 @@ static inline void reset_LastError()
|
|||||||
#define PRINT_DEBUG_CLEANUP() (void)0
|
#define PRINT_DEBUG_CLEANUP() (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define PRINT_DEBUG(...) fprintf(stdout, __VA_ARGS__)
|
extern dbg_log dbg_logger;
|
||||||
extern const std::string dbg_log_file;
|
|
||||||
extern const std::chrono::time_point<std::chrono::high_resolution_clock> startup_counter;
|
|
||||||
|
|
||||||
#define PRINT_DEBUG(a, ...) do { \
|
#define PRINT_DEBUG(a, ...) do { \
|
||||||
auto __prnt_dbg_ctr = std::chrono::high_resolution_clock::now(); \
|
dbg_logger.write("[tid %lld] %s " a, PRINT_DEBUG_TID(), EMU_FUNC_NAME, ##__VA_ARGS__); \
|
||||||
auto __prnt_dbg_duration = __prnt_dbg_ctr - startup_counter; \
|
PRINT_DEBUG_CLEANUP(); \
|
||||||
auto __prnt_dbg_micro = std::chrono::duration_cast<std::chrono::duration<unsigned long long, std::micro>>(__prnt_dbg_duration); \
|
|
||||||
auto __prnt_dbg_ms = std::chrono::duration_cast<std::chrono::duration<unsigned long long, std::milli>>(__prnt_dbg_duration); \
|
|
||||||
auto __prnt_dbg_f = fopen(dbg_log_file.c_str(), "a"); \
|
|
||||||
if (!__prnt_dbg_f) break; \
|
|
||||||
fprintf(__prnt_dbg_f, "[%llu ms, %lld us] [tid %lld] %s " a "\n", \
|
|
||||||
__prnt_dbg_ms.count(), __prnt_dbg_micro.count(), PRINT_DEBUG_TID(), EMU_FUNC_NAME, ##__VA_ARGS__); \
|
|
||||||
fclose(__prnt_dbg_f); \
|
|
||||||
PRINT_DEBUG_CLEANUP(); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#else // EMU_RELEASE_BUILD
|
#else // EMU_RELEASE_BUILD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user