ObsidianDragon - DragonX ImGui Wallet
Full-node GUI wallet for DragonX cryptocurrency. Built with Dear ImGui, SDL3, and OpenGL3/DX11. Features: - Send/receive shielded and transparent transactions - Autoshield with merged transaction display - Built-in CPU mining (xmrig) - Peer management and network monitoring - Wallet encryption with PIN lock - QR code generation for receive addresses - Transaction history with pagination - Console for direct RPC commands - Cross-platform (Linux, Windows)
This commit is contained in:
65
src/util/logger.h
Normal file
65
src/util/logger.h
Normal file
@@ -0,0 +1,65 @@
|
||||
// DragonX Wallet - ImGui Edition
|
||||
// Copyright 2024-2026 The Hush Developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
|
||||
namespace dragonx {
|
||||
namespace util {
|
||||
|
||||
/**
|
||||
* @brief Simple file logger
|
||||
*/
|
||||
class Logger {
|
||||
public:
|
||||
Logger();
|
||||
~Logger();
|
||||
|
||||
/**
|
||||
* @brief Initialize logger with output file
|
||||
* @param path Path to log file
|
||||
* @return true if opened successfully
|
||||
*/
|
||||
bool init(const std::string& path);
|
||||
|
||||
/**
|
||||
* @brief Write a log message
|
||||
* @param message Message to log
|
||||
*/
|
||||
void write(const std::string& message);
|
||||
|
||||
/**
|
||||
* @brief Write a formatted log message
|
||||
* @param format printf-style format string
|
||||
*/
|
||||
void writef(const char* format, ...);
|
||||
|
||||
/**
|
||||
* @brief Get the singleton instance
|
||||
*/
|
||||
static Logger& instance();
|
||||
|
||||
private:
|
||||
std::ofstream file_;
|
||||
std::mutex mutex_;
|
||||
bool initialized_ = false;
|
||||
};
|
||||
|
||||
// Convenience macros
|
||||
#define LOG(msg) dragonx::util::Logger::instance().write(msg)
|
||||
#define LOGF(...) dragonx::util::Logger::instance().writef(__VA_ARGS__)
|
||||
|
||||
#ifdef DRAGONX_DEBUG
|
||||
#define DEBUG_LOG(msg) LOG(msg)
|
||||
#define DEBUG_LOGF(...) LOGF(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_LOG(msg)
|
||||
#define DEBUG_LOGF(...)
|
||||
#endif
|
||||
|
||||
} // namespace util
|
||||
} // namespace dragonx
|
||||
Reference in New Issue
Block a user