Former-commit-id: 0da715a3ab6b34b3ffe65659a6d46bb542a12897 [formerly c4033c72ac80435a188a50197bc382be9b413c63] [formerly 989f44ed7d63b9f6c3b125694b7855de8e51bacf [formerly a0a4effadc32a802ee2d56429326f1a935bb4d4a]] Former-commit-id: 04addee943f199d59be5cafff05009b191415158 [formerly a787ddc27a06f6b39097b1813235cfe3d33aba30] Former-commit-id: e4f09a35f3dff825c3bafa0f7614526ce01a8e60
62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
// Copyright (C) 2015 Jérôme Leclercq
|
|
// This file is part of the "Nazara Engine - Core module"
|
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
|
|
|
#pragma once
|
|
|
|
#ifndef NAZARA_LOG_HPP
|
|
#define NAZARA_LOG_HPP
|
|
|
|
#include <Nazara/Prerequesites.hpp>
|
|
#include <Nazara/Core/AbstractLogger.hpp>
|
|
#include <Nazara/Core/Error.hpp>
|
|
#include <Nazara/Core/Signal.hpp>
|
|
#include <Nazara/Core/String.hpp>
|
|
#include <memory>
|
|
|
|
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_LOG
|
|
#include <Nazara/Core/ThreadSafety.hpp>
|
|
#else
|
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
|
#endif
|
|
|
|
#ifdef NAZARA_DEBUG
|
|
#define NazaraDebug(txt) NazaraNotice(txt)
|
|
#else
|
|
#define NazaraDebug(txt)
|
|
#endif
|
|
|
|
#define NazaraNotice(txt) Nz::Log::Write(txt)
|
|
|
|
namespace Nz
|
|
{
|
|
class NAZARA_CORE_API Log
|
|
{
|
|
friend class Core;
|
|
|
|
public:
|
|
static void Enable(bool enable);
|
|
|
|
static AbstractLogger* GetLogger();
|
|
|
|
static bool IsEnabled();
|
|
|
|
static void SetLogger(AbstractLogger* logger);
|
|
|
|
static void Write(const String& string);
|
|
static void WriteError(ErrorType type, const String& error, unsigned int line = 0, const char* file = nullptr, const char* function = nullptr);
|
|
|
|
NazaraStaticSignal(OnLogWrite, const String& /*string*/);
|
|
NazaraStaticSignal(OnLogWriteError, ErrorType /*type*/, const String& /*error*/, unsigned int /*line*/, const char* /*file*/, const char* /*function*/);
|
|
|
|
private:
|
|
static bool Initialize();
|
|
static void Uninitialize();
|
|
|
|
static AbstractLogger* s_logger;
|
|
static bool s_enabled;
|
|
};
|
|
}
|
|
|
|
#endif // NAZARA_LOGGER_HPP
|