Beginning documentation effort.
This commit is contained in:
@@ -20,14 +20,16 @@
|
||||
|
||||
namespace jlog
|
||||
{
|
||||
/// Severity levels for logging. Higher numbers filter less messages out.
|
||||
/// @see LOG_LEVEL macro
|
||||
enum class severity : uint8_t
|
||||
{
|
||||
none,
|
||||
warning,
|
||||
error,
|
||||
fatal,
|
||||
verbose,
|
||||
debug,
|
||||
none, // Show no output
|
||||
fatal, // Show only fatal errors
|
||||
error, // Show fatal and not-necessarily-fatal errors
|
||||
warning, // Show warnings additionally
|
||||
verbose, // Show errors, warnings, and 'verbose' output (i.e. extra information)
|
||||
debug, // Show debugging messages (Basically everything).
|
||||
};
|
||||
|
||||
inline severity loglevel = severity::debug; // Default log level always debug
|
||||
@@ -44,6 +46,8 @@ namespace jlog
|
||||
|
||||
inline std::vector<LogEntry> log_history;
|
||||
|
||||
/// A single piece of a logging message, with color code, content, and delimiter
|
||||
/// These are strung together to build full logger messages in a flexible manner.
|
||||
struct token
|
||||
{
|
||||
colorcode colorCode = color_codes::FG_DEFAULT;
|
||||
@@ -54,14 +58,31 @@ namespace jlog
|
||||
void set_default_logfile(const std::string& filename);
|
||||
|
||||
std::string get_timestamp();
|
||||
|
||||
/// Writes an input string directly to standard output
|
||||
/// @note Does not append a newline to the message.
|
||||
void log_to_console(const std::string& message);
|
||||
/// Writes an input string directly to the default destination logfile
|
||||
/// @note Does not append a newline to the message.
|
||||
/// @see set_default_logfile()
|
||||
void log_to_file(const std::string& message);
|
||||
/// Writes an input string directly to the specified destination logfile
|
||||
/// @note Does not append a newline to the message.
|
||||
void log_to_file(const std::string& filename, const std::string& message);
|
||||
/// Writes an input string directly to the specified output stream
|
||||
/// @note Does not append a newline to the message.
|
||||
void log_to_stream(std::ostream stream, const std::string& message);
|
||||
|
||||
/// Parses a sequence of tokens into a printable message, and logs to the following destinations:
|
||||
/// standard output (console)
|
||||
/// output file (default)
|
||||
/// logging callback (Event)
|
||||
/// @note This file is implemented differently per-platform to handle differences in console color handling.
|
||||
/// @see windows/jlog.cpp linux/jlog.cpp
|
||||
void log(std::vector<token> tokens);
|
||||
|
||||
// Generic formatters for building loggers.
|
||||
|
||||
std::vector<token> trace_format(
|
||||
const std::string& func,
|
||||
const std::string& file,
|
||||
|
Reference in New Issue
Block a user