Files
jsix_import/src/tests/logger.cpp
F in Chat for Tabs 8f529046a9 [project] Lose the battle between tabs & spaces
I'm a tabs guy. I like tabs, it's an elegant way to represent
indentation instead of brute-forcing it. But I have to admit that the
world seems to be going towards spaces, and tooling tends not to play
nice with tabs. So here we go, changing the whole repo to spaces since
I'm getting tired of all the inconsistent formatting.
2021-08-01 17:46:16 -07:00

33 lines
914 B
C++

#include "kutil/constexpr_hash.h"
#include "kutil/logger.h"
#include "catch.hpp"
using namespace kutil;
uint8_t test_log_buffer[0x400];
const char *name1 = "test_area1";
log::area_t hash1 = "test_area1"_h;
const char *name2 = "test_area2";
log::area_t hash2 = "test_area2"_h;
TEST_CASE( "logger writing", "[logger]" )
{
log::logger logger(test_log_buffer, sizeof(test_log_buffer));
logger.register_area(hash1, name1, log::level::debug);
logger.register_area(hash2, name2, log::level::debug);
CHECK( hash1 != hash2 );
const char *check1 = logger.area_name(hash1);
const char *check2 = logger.area_name(hash2);
CHECK( check1 == name1 );
CHECK( check2 == name2 );
log::debug(hash1, "This is a thing %016lx", 35);
log::info(hash2, "This is a string %s", "foo");
log::warn(hash1, "This is a thing %016lx", 682);
log::error(hash2, "This is a string %s", "bar");
}