More documentation
This commit is contained in:
@@ -56,6 +56,7 @@ namespace jlog
|
||||
|
||||
void set_default_logfile(const std::string& filename);
|
||||
|
||||
/// Returns a string timestamp in the format of 'YYYY-MM-DD hh:mm:ss.ms'
|
||||
std::string get_timestamp();
|
||||
|
||||
/// Writes an input string directly to standard output
|
||||
@@ -80,18 +81,33 @@ namespace jlog
|
||||
/// @see windows/jlog.cpp linux/jlog.cpp
|
||||
void log(std::vector<token> tokens);
|
||||
|
||||
// Generic formatters for building loggers.
|
||||
#pragma region Generic Formatters
|
||||
|
||||
/// Returns a pseudo-"stacktrace" formatted sequence of tokens.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> trace_format(
|
||||
const std::string& func,
|
||||
const std::string& file,
|
||||
int line);
|
||||
|
||||
/// Returns a formatted sequence of tokens given a severity and message.
|
||||
/// @param severity_name The severity tag to prefix to the message. Could theoretically also be a context.
|
||||
/// @param message The actual message to include
|
||||
/// @param severity_cc The colorcode to assign to the severity. See color_codes.hpp
|
||||
std::vector<token> log_format(
|
||||
const std::string& severity_name,
|
||||
const std::string& message,
|
||||
const colorcode& severity_cc = color_codes::FG_WHITE);
|
||||
|
||||
/// Returns a more detailed formatted sequence of tokens.
|
||||
/// @param severity_name The severity tag to prefix to the message. Could theoretically also be a context.
|
||||
/// @param message The actual message to include
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
/// @param severity_cc The colorcode to assign to the severity. See color_codes.hpp
|
||||
std::vector<token> log_detailed_format(
|
||||
const std::string& severity_name,
|
||||
const std::string& message,
|
||||
@@ -100,54 +116,96 @@ namespace jlog
|
||||
int line,
|
||||
const colorcode& severity_cc = color_codes::FG_WHITE);
|
||||
|
||||
// Predefined generic loggers for jlog.
|
||||
/// Returns a token sequence pre-formatted for the INFO log level.
|
||||
/// @param message The message to send out.
|
||||
std::vector<token> info_format(const std::string& message);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the INFO log level.
|
||||
/// @param message The message to send out.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> info_detailed_format(
|
||||
const std::string &message,
|
||||
const std::string &func,
|
||||
const std::string &file,
|
||||
int line);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the WARNING log level.
|
||||
/// @param message The message to send out.
|
||||
std::vector<token> warning_format(const std::string& message);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the WARNING log level.
|
||||
/// @param message The message to send out.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> warning_detailed_format(
|
||||
const std::string &message,
|
||||
const std::string &func,
|
||||
const std::string &file,
|
||||
int line);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the ERROR log level.
|
||||
/// @param message The message to send out.
|
||||
std::vector<token> error_format(const std::string& message);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the ERROR log level.
|
||||
/// @param message The message to send out.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> error_detailed_format(
|
||||
const std::string &message,
|
||||
const std::string &func,
|
||||
const std::string &file,
|
||||
int line);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the FATAL log level.
|
||||
/// @param message The message to send out.
|
||||
std::vector<token> fatal_format(const std::string& message);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the FATAL log level.
|
||||
/// @param message The message to send out.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> fatal_detailed_format(
|
||||
const std::string &message,
|
||||
const std::string &func,
|
||||
const std::string &file,
|
||||
int line);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the VERBOSE log level.
|
||||
/// @param message The message to send out.
|
||||
std::vector<token> verbose_format(const std::string& message);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the VERBOSE log level.
|
||||
/// @param message The message to send out.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> verbose_detailed_format(
|
||||
const std::string &message,
|
||||
const std::string &func,
|
||||
const std::string &file,
|
||||
int line);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the DEBUG log level.
|
||||
/// @param message The message to send out.
|
||||
std::vector<token> debug_format(const std::string& message);
|
||||
|
||||
/// Returns a token sequence pre-formatted for the DEBUG log level.
|
||||
/// @param message The message to send out.
|
||||
/// @param func The function name/signature to trace back to. Should be provided by a __FUNCTION__ macro variant.
|
||||
/// @param file The file name to trace back to. Should be provided by a __FILE__ macro variant.
|
||||
/// @param line The source-code line to trace back to. Should be provided by a __LINE__ macro variant.
|
||||
std::vector<token> debug_detailed_format(
|
||||
const std::string &message,
|
||||
const std::string &func,
|
||||
const std::string &file,
|
||||
int line);
|
||||
#pragma endregion
|
||||
}
|
||||
|
||||
#define INFO(i) if (jlog::loglevel >= jlog::severity::none) { jlog::log(jlog::info_detailed_format(i, FUNCTION, __FILE__, __LINE__)); }
|
||||
|
Reference in New Issue
Block a user