Implement basic capability to log to specified file.

This commit is contained in:
2024-06-27 14:57:14 -04:00
parent f0ccdf00c0
commit 4138b45404
3 changed files with 29 additions and 2 deletions

View File

@@ -3,7 +3,6 @@
/// Developed & Maintained by Josh O'Leary
/// This work is dedicated to the public domain.
#pragma once
#include <format>
@@ -40,6 +39,7 @@ namespace jlog
std::string timestamp;
};
// TODO: Fully implement logging callback.
static Event<LogEntry> on_log = Event<LogEntry>();
inline std::vector<LogEntry> log_history;
@@ -51,9 +51,13 @@ namespace jlog
std::string delimiter = "[]";
};
void set_default_logfile(const std::string& filename);
std::string get_timestamp();
void log_to_console(const std::string& message);
void log_to_file(const std::string& message);
void log_to_file(const std::string& filename, const std::string& message);
void log_to_stream(std::ostream stream, const std::string& message);
void log(std::vector<token> tokens);