initial work on loggin class
This commit is contained in:
parent
08f8da2fea
commit
81ca77a464
|
@ -26,7 +26,7 @@ add_executable(shadps4
|
|||
src/Loader/Elf.cpp
|
||||
src/Loader/Elf.h
|
||||
src/GUI/ElfViewer.cpp
|
||||
src/GUI/ElfViewer.h)
|
||||
src/GUI/ElfViewer.h "src/Util/Log.h" "src/Util/Log.cpp")
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include <vector>
|
||||
#include <spdlog/common.h>
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
|
||||
|
||||
|
||||
namespace logging {
|
||||
std::vector<spdlog::sink_ptr> sinks;
|
||||
|
||||
int init(bool use_stdout) {
|
||||
sinks.clear();//clear existing sinks
|
||||
if (use_stdout)//if we use stdout window then init it as well
|
||||
sinks.push_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
|
||||
|
||||
return 0;//all ok
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
|
||||
namespace logging {
|
||||
|
||||
#define LOG_TRACE SPDLOG_TRACE
|
||||
#define LOG_DEBUG SPDLOG_DEBUG
|
||||
#define LOG_INFO SPDLOG_INFO
|
||||
#define LOG_WARN SPDLOG_WARN
|
||||
#define LOG_ERROR SPDLOG_ERROR
|
||||
#define LOG_CRITICAL SPDLOG_CRITICAL
|
||||
|
||||
#define LOG_TRACE_IF(flag, ...) \
|
||||
if (flag) \
|
||||
LOG_TRACE(__VA_ARGS__)
|
||||
#define LOG_DEBUG_IF(flag, ...) \
|
||||
if (flag) \
|
||||
LOG_DEBUG(__VA_ARGS__)
|
||||
#define LOG_INFO_IF(flag, ...) \
|
||||
if (flag) \
|
||||
LOG_INFO(__VA_ARGS__)
|
||||
#define LOG_WARN_IF(flag, ...) \
|
||||
if (flag) \
|
||||
LOG_WARN(__VA_ARGS__)
|
||||
#define LOG_ERROR_IF(flag, ...) \
|
||||
if (flag) \
|
||||
LOG_ERROR(__VA_ARGS__)
|
||||
#define LOG_CRITICAL_IF(flag, ...) \
|
||||
if (flag) \
|
||||
LOG_CRITICAL(__VA_ARGS__)
|
||||
|
||||
int init(bool use_stdout);
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
#include "types.h"
|
||||
#include "Loader/Elf.h"
|
||||
#include "GUI/ElfViewer.h"
|
||||
#include "Util/Log.h"
|
||||
|
||||
// This example can also compile and run with Emscripten! See 'Makefile.emscripten' for details.
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
@ -27,6 +28,7 @@
|
|||
// Main code
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
logging::init(true);//init logging
|
||||
const char* const path = argv[1]; //argument 1 is the path of self file to boot
|
||||
Elf* elf = new Elf;
|
||||
elf->Open(path);
|
||||
|
|
Loading…
Reference in New Issue