Files
OpenVulkano/openVulkanoCpp/Base/Logger.hpp
2020-08-14 21:32:17 +02:00

45 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 <spdlog/spdlog.h>
namespace openVulkanoCpp
{
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:
static std::shared_ptr<spdlog::logger> WINDOW;
static std::shared_ptr<spdlog::logger> MANAGER;
static std::shared_ptr<spdlog::logger> RENDER;
static std::shared_ptr<spdlog::logger> PHYSIC;
static std::shared_ptr<spdlog::logger> AUDIO;
static std::shared_ptr<spdlog::logger> DATA;
static std::shared_ptr<spdlog::logger> SCENE;
static std::shared_ptr<spdlog::logger> INPUT;
static void SetupLogger(const std::string& logFolder = "logs", const std::string& logFile = "openVulkano.log");
/**
* \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
*/
static std::shared_ptr<spdlog::logger> CreateLogger(const std::string& name, bool reg = true);
static std::shared_ptr<spdlog::logger> GetLogger(const std::string& name);
static void RegisterSink(const spdlog::sink_ptr& newSink);
};
}