add logger history

This commit is contained in:
2026-05-19 18:43:57 -05:00
parent fbb618711f
commit 964425e7b8
3 changed files with 38 additions and 16 deletions

View File

@@ -3,10 +3,12 @@
int main(void) {
Logger logger = {0};
lLog(logger, lINFO, lLogString_new("Hello, INFO!"));
lLog(logger, lWARNING, lLogString_new("Hello, WARNING!"));
lLog(logger, lERROR, lLogString_new("Hello, ERROR!"));
lLog(logger, lDEBUG, lLogString_new("Hello, DEBUG!"));
int message_1_id = lLog(&logger, lINFO, lLogString_new("Hello, INFO!"));
lLog(&logger, lINFO, logger.history.items[message_1_id]);
int message_2_id = lLog(&logger, lWARNING, lLogString_new("Hello, WARNING!"));
int message_3_id = lLog(&logger, lERROR, lLogString_new("Hello, ERROR!"));
int message_4_id = lLog(&logger, lDEBUG, lLogString_new("Hello, DEBUG!"));
int timer = create_timer(&logger);
lTimespan* time_object = &logger.timers.items[timer].time;
@@ -15,5 +17,5 @@ int main(void) {
sleep(2);
stop_timer(&logger, timer);
lLog(logger, lINFO, lLogString_new("%f seconds.", difftime(time_object->end, time_object->start)));
lLog(&logger, lINFO, lLogString_new("%f seconds.", difftime(time_object->end, time_object->start)));
}