stupid work log stuff

main
Brett 2025-03-09 23:14:27 -04:00
parent b334bbcae4
commit deacad5358
4 changed files with 29 additions and 48 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake)
set(BLT_VERSION 5.2.5)
set(BLT_VERSION 5.2.6)
set(BLT_TARGET BLT)

View File

@ -20,7 +20,7 @@
#define BLT_BOXING_H
#include <blt/std/types.h>
#include <blt/std/logging.h>
#include <blt/logging/logging.h>
#include <string>
namespace blt
@ -84,25 +84,6 @@ namespace blt
Logger& logger;
};
template<>
class log_box_t<blt::logging::logger> : detail::log_box_base_t
{
public:
log_box_t(blt::logging::logger logger, std::string_view title, blt::size_t padding = 0): detail::log_box_base_t(title, padding), logger(logger)
{
make_full_title(logger);
logger << '\n';
}
~log_box_t()
{
make_full_width_line(logger);
logger << '\n';
}
private:
blt::logging::logger logger;
};
template<typename Logger>
log_box_t(Logger&& logger, std::string_view, blt::size_t) -> log_box_t<Logger>;

View File

@ -9,7 +9,7 @@
#include <blt/math/vectors.h>
#include <blt/math/matrix.h>
#include <blt/std/logging.h>
#include <blt/logging/logging.h>
#include <blt/std/utility.h>
#include "blt/std/string.h"

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <blt/std/logging.h>
#include <blt/logging/logging.h>
#include <blt/std/types.h>
#include <blt/std/assert.h>
#include <blt/math/vectors.h>
@ -64,18 +64,18 @@ void test_enumerate()
{
blt::log_box_t box(std::cout, "Enumerate Tests", 25);
for (const auto& [index, item] : blt::enumerate(array_1))
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_TRACE("");
for (const auto& [index, item] : blt::enumerate(array_1).rev())
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_TRACE("");
for (const auto& [index, item] : blt::enumerate(array_1).take(3))
{
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_ASSERT(index < 3);
}
@ -83,7 +83,7 @@ void test_enumerate()
for (const auto& [index, item] : blt::enumerate(array_1).take(3).rev())
{
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_ASSERT(index < 3);
}
@ -91,7 +91,7 @@ void test_enumerate()
for (const auto& [index, item] : blt::enumerate(array_1).skip(3))
{
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_ASSERT(index >= 3);
}
@ -99,7 +99,7 @@ void test_enumerate()
for (const auto& [index, item] : blt::enumerate(array_1).skip(3).rev())
{
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_ASSERT(index >= 3);
}
@ -107,7 +107,7 @@ void test_enumerate()
for (const auto& [index, item] : blt::enumerate(array_1).skip(3).take(5))
{
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_ASSERT(index >= 3 && index < (array_1.size() - 5) + 3);
}
@ -115,7 +115,7 @@ void test_enumerate()
for (const auto& [index, item] : blt::enumerate(array_1).skip(3).rev().take(5))
{
BLT_TRACE_STREAM << index << " : " << item << "\n";
BLT_TRACE("{}, : {}", index, item);
BLT_ASSERT(index >= 5);
}
}
@ -125,7 +125,7 @@ void test_pairs()
blt::log_box_t box(std::cout, "Pairs Tests", 25);
for (auto [a1, a2] : blt::in_pairs(array_1, array_2))
{
BLT_TRACE_STREAM << a1 << " : " << a2 << "\n";
BLT_TRACE("{}, : {}", a1, a2);
}
}
@ -134,32 +134,32 @@ void test_zip()
blt::log_box_t box(std::cout, "Zip Tests", 25);
for (auto [a1, a2, a3] : blt::zip(array_1, array_2, list_1))
{
BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n";
BLT_TRACE("{} : {} : {}", a1, a2, a3);
}
BLT_TRACE("================================");
for (auto [a1, a2, a3] : blt::zip(array_1, array_2, list_1).take(3))
{
BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n";
BLT_TRACE("{} : {} : {}", a1, a2, a3);
}
BLT_TRACE("================================");
for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).take(3).rev())
{
BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n";
BLT_TRACE("{} : {} : {}", a1, a2, a3);
}
BLT_TRACE("================================");
for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).take_or(13))
{
BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n";
BLT_TRACE("{} : {} : {}", a1, a2, a3);
}
BLT_TRACE("================================");
for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).rev().take(3))
{
BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n";
BLT_TRACE("{} : {} : {}", a1, a2, a3);
}
BLT_TRACE("================================");
for (auto [a1, a2, a3] : blt::zip(array_1, array_2, array_3).skip(2).rev())
{
BLT_TRACE_STREAM << a1 << " : " << a2 << " : " << a3 << "\n";
BLT_TRACE("{} : {} : {}", a1, a2, a3);
}
}
@ -168,33 +168,33 @@ void test_iterate()
blt::log_box_t box(std::cout, "Iterate Tests", 25);
for (auto v : blt::iterate(array_1))
{
BLT_TRACE_STREAM << "Element: " << v << "\n";
BLT_TRACE("Element: {}", v);
}
BLT_TRACE("================================");
for (auto v : blt::iterate(array_1).skip(5))
{
BLT_TRACE_STREAM << "Element: " << v << "\n";
BLT_TRACE("Element: {}", v);
}
BLT_TRACE("================================");
for (auto v : blt::iterate(array_1).take(5))
{
BLT_TRACE_STREAM << "Element: " << v << "\n";
BLT_TRACE("Element: {}", v);
}
BLT_TRACE("================================");
for (auto v : blt::iterate(array_1).rev())
{
BLT_TRACE_STREAM << "Element: " << v << "\n";
BLT_TRACE("Element: {}", v);
}
BLT_TRACE("================================");
for (auto [a, b] : blt::iterate(array_1).zip(list_1))
{
BLT_TRACE_STREAM << "Zip: " << a << " " << b << "\n";
BLT_TRACE("Zip: {} {}", a, b);
}
BLT_TRACE("================================");
for (auto [i, data] : blt::iterate(array_1).map([](const blt::vec2& in) { return in.normalize(); }).zip(list_1).skip(3).take(4).enumerate())
{
auto [a, b] = data;
BLT_TRACE_STREAM << "Map + Zip + Skip + Take + Enumerate (Index: " << i << ")> " << a << " " << b << "\n";
BLT_TRACE("Map + Zip + Skip + Take + Enumerate (Index: {})> {} {}", i, a, b);
}
BLT_TRACE("================================");
for (auto [i, data] : blt::iterate(array_1).map(
@ -203,7 +203,7 @@ void test_iterate()
}).zip(list_1).skip(3).take(4).enumerate())
{
auto [a, b] = data;
BLT_TRACE_STREAM << "Map + Zip + Skip + Take + Enumerate (Index: " << i << ")> " << a << " " << b << "\n";
BLT_TRACE("Map + Zip + Skip + Take + Enumerate (Index: {})> {} {}", i, a, b);
}
BLT_TRACE("================================");
for (auto a : blt::iterate(array_1).map([](const blt::vec2& in) { return in.normalize(); })
@ -212,7 +212,7 @@ void test_iterate()
if (!a)
continue;
auto v = *a;
BLT_TRACE_STREAM << " So this one works? " << v << "\n";
BLT_TRACE(" So this one works? {}", v);
}
BLT_TRACE("================================");
for (auto a : blt::iterate(array_1).map([](const blt::vec2& in) { return in.normalize(); })
@ -221,7 +221,7 @@ void test_iterate()
if (!a)
continue;
auto [index, v] = *a;
BLT_TRACE_STREAM << " So this one works? (" << index << ")" << v << "\n";
BLT_TRACE(" So this one works? ({}) {}", index, v);
}
BLT_TRACE("================================");
// for (auto a : blt::iterate(array_1).filter([](const auto& f) { return f.x() > 3 && f.y() < 6; }).take(2))
@ -233,7 +233,7 @@ void test_iterate()
// }
for (auto a : blt::iterate(array_1).map([](const auto& f) { return f.x() > 3 && f.y() < 6; }))
{
BLT_TRACE_STREAM << " How about this one?? " << a << "\n";
BLT_TRACE(" How about this one?? ({}) {}", a);
}
// for (auto [value, a] : blt::iterate(array_1).map(