Files
OpenVulkano/openVulkanoCpp/Base/Logger.hpp

52 lines
1.5 KiB
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#define SPDLOG_DEBUG_ON
#define SPDLOG_TRACE_ON
#include "Extensions/FmtFormatter.hpp"
#include <spdlog/spdlog.h>
namespace OpenVulkano
{
class Logger
{ //TODO add custom sink for in game/engine console
static std::vector<spdlog::sink_ptr> SINKS;
static std::vector<std::weak_ptr<spdlog::logger>> LOGGERS;
public:
typedef std::shared_ptr<spdlog::logger> Ptr;
static Ptr WINDOW;
static Ptr MANAGER;
static Ptr RENDER;
static Ptr PHYSIC;
static Ptr AUDIO;
static Ptr DATA;
static Ptr SCENE;
static Ptr INPUT;
static Ptr FILESYS;
static Ptr AR;
static Ptr PERF;
static Ptr APP;
static void SetupLogger(std::string logFolder = "", const std::string& logFile = "openVulkano.log", bool handleSignals = false);
/**
* \brief Creates a new custom logger that writes to the main log file.
* \param name The name of the logger
* \param reg If set to true the logger can be accessed again with Logger::GetLogger(name)
* \return The created logger, if reg = true and a logger with the given name already exists this function will return the old logger.
*/
static Ptr CreateLogger(const std::string& name, bool reg = true);
static Ptr GetLogger(const std::string& name);
static void RegisterSink(const spdlog::sink_ptr& newSink);
};
}