voxspatium/src/util/Log.h

48 lines
1.3 KiB
C
Raw Normal View History

2018-04-14 14:42:32 +00:00
// Universium Engine - Voxel Planets engine
// Copyright (C) 2018 Evert "Diamond" Prants <evert@lunasqu.ee>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-04-14 06:53:15 +00:00
#ifndef __LOG_H__
#define __LOG_H__
#include "Application.h"
#include <string>
#include <stdlib.h>
#define FPRNT(io,tag,message) fprintf(io, "[%s] %s\n", tag, message.c_str());
inline void fatalError(const std::string message)
{
FPRNT(stderr, "FATAL ERROR", message);
2018-04-14 14:42:32 +00:00
Application::getInstance().exit();
2018-04-14 06:53:15 +00:00
}
2018-04-14 14:42:32 +00:00
inline void logInfo(const std::string& message)
2018-04-14 06:53:15 +00:00
{
FPRNT(stdout, "Info", message);
}
2018-04-14 14:42:32 +00:00
inline void logWarn(const std::string& message)
2018-04-14 06:53:15 +00:00
{
FPRNT(stdout, "Warning", message);
}
2018-04-14 14:42:32 +00:00
inline void logError(const std::string& message)
2018-04-14 06:53:15 +00:00
{
FPRNT(stdout, "Error", message);
}
#endif // __LOG_H__