2012-09-09 20:50:15 +00:00
|
|
|
/*
|
|
|
|
* Log.h
|
|
|
|
*
|
|
|
|
* Created on: 25.07.2012
|
|
|
|
* Author: Felix
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DG_LOG_H_
|
|
|
|
#define DG_LOG_H_
|
|
|
|
|
2013-04-05 14:54:51 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2013-05-26 18:57:37 +00:00
|
|
|
#include <SFML/System/Vector2.hpp>
|
|
|
|
#include <SFML/Graphics/Rect.hpp>
|
|
|
|
|
2012-09-16 18:45:12 +00:00
|
|
|
/**
|
|
|
|
* Logging functions for different levels.
|
|
|
|
*
|
|
|
|
* @code
|
|
|
|
* LOG_E("something bad happened");
|
2012-09-25 16:20:45 +00:00
|
|
|
* LOG_I(1 << 2 << 3 << "takeoff");
|
2012-09-16 18:45:12 +00:00
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
|
2012-09-09 20:50:15 +00:00
|
|
|
/**
|
|
|
|
* \def LOG_E(str)
|
|
|
|
* Log an error to the error stream.
|
|
|
|
*/
|
2012-09-25 16:20:45 +00:00
|
|
|
#define LOG_E(str) std::cout << __FILE__ << ":" << __LINE__ << " " << "Error: " << str << std::endl
|
2012-09-09 20:50:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \def LOG_E(str)
|
|
|
|
* Log a warning to the output stream.
|
|
|
|
*/
|
2012-09-25 16:20:45 +00:00
|
|
|
#define LOG_W(str) std::cout << __FILE__ << ":" << __LINE__ << " " << "Warning: " << str << std::endl
|
2012-09-09 20:50:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \def LOG_E(str)
|
|
|
|
* Log a debug message to the output stream.
|
|
|
|
*/
|
2012-09-25 16:20:45 +00:00
|
|
|
#define LOG_D(str) std::cout << __FILE__ << ":" << __LINE__ << " " << "Debug: " << str << std::endl
|
2012-09-09 20:50:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \def LOG_E(str)
|
|
|
|
* Log an info to the output stream.
|
|
|
|
*/
|
2012-09-25 16:20:45 +00:00
|
|
|
#define LOG_I(str) std::cout << __FILE__ << ":" << __LINE__ << " " << "Info: " << str << std::endl
|
|
|
|
|
|
|
|
/**
|
2012-12-22 14:10:26 +00:00
|
|
|
* Adds an output operator specalization for sf::Vector2f.
|
2012-09-25 16:20:45 +00:00
|
|
|
*/
|
|
|
|
inline std::ostream&
|
2012-12-22 14:10:26 +00:00
|
|
|
operator<<(std::ostream& os, const sf::Vector2f& vector) {
|
2012-09-25 16:20:45 +00:00
|
|
|
os << "(" << vector.x << ", " << vector.y << ")";
|
|
|
|
return os;
|
|
|
|
}
|
2012-09-09 20:50:15 +00:00
|
|
|
|
2012-10-13 10:02:04 +00:00
|
|
|
/**
|
2012-12-22 14:10:26 +00:00
|
|
|
* Adds an output operator specalization for sf::Vector2i
|
2012-10-13 10:02:04 +00:00
|
|
|
*/
|
|
|
|
inline std::ostream&
|
2012-12-22 14:10:26 +00:00
|
|
|
operator<<(std::ostream& os, const sf::Vector2i& vector) {
|
2012-10-13 10:02:04 +00:00
|
|
|
os << "(" << vector.x << ", " << vector.y << ")";
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2013-05-26 18:57:37 +00:00
|
|
|
/**
|
|
|
|
* Adds an output operator specalization for sf::FloatRect
|
|
|
|
*/
|
|
|
|
inline std::ostream&
|
|
|
|
operator<<(std::ostream& os, const sf::FloatRect& rect) {
|
|
|
|
os << "(x: " << rect.left << ", y: " << rect.top << ", w: " <<
|
|
|
|
rect.width << ", h: " << rect.height << ")";
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an output operator specalization for sf::IntRect
|
|
|
|
*/
|
|
|
|
inline std::ostream&
|
|
|
|
operator<<(std::ostream& os, const sf::IntRect& rect) {
|
|
|
|
os << "(x: " << rect.left << ", y: " << rect.top << ", w: " <<
|
|
|
|
rect.width << ", h: " << rect.height << ")";
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2012-09-16 18:45:12 +00:00
|
|
|
#endif /* DG_LOG_H_ */
|