Skip to content

Commit

Permalink
some more minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinzii committed Nov 20, 2023
1 parent 943863e commit b549f2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
23 changes: 19 additions & 4 deletions engine/include/gen/logger/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

namespace gen::logger
{
///
/// \brief Timestamp mode.
///
enum class Timestamp
{
eLocal,
Expand All @@ -35,7 +33,24 @@ namespace gen::logger
/// timestamp: log timestamp
///
static constexpr std::string_view default_format_v{"[{level}][T{thread}] [{category}] {message} [{timestamp}]"};
static constexpr std::string_view verbose_format_v{"[{level}][T{thread}] [{category}] {message} [{timestamp}] [F:{func}] [{file}:{line}]"};

///
/// \brief Default format specification for verbose log entries.
///
/// Syntax: "{format_key}..."
/// Text not matching any format keys will be passed through.
///
/// Supported format keys:
/// level: log Level
/// thread: current (logging) thread ID
/// category: log category
/// message: log message
/// timestamp: log timestamp
/// func: function name
/// file: file name
/// line: line number
///
static constexpr std::string_view verbose_format_v{"[{level}][T{thread}] [{category}] {message} [{timestamp}] [F: {func}] [{file}:{line}]"};

static constexpr std::size_t format_size_v{128};

Expand All @@ -57,7 +72,7 @@ namespace gen::logger
/// \brief Timestamp mode.
Timestamp timestamp{Timestamp::eLocal};

/// \brief Whether to print verbose information.
/// \brief Whether to print verbose logging information.
bool verbose{false};
};
} // namespace gen::logger
3 changes: 1 addition & 2 deletions engine/src/logger/instance.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2023-present Genesis Engine contributors (see LICENSE.txt)

#include "gen/logger/instance.hpp"
#include <algorithm>
#include <condition_variable>
#include <filesystem>
#include <fstream>
Expand Down Expand Up @@ -244,7 +243,7 @@ namespace gen::logger

Impl(char const * filePath) : file(nonEmptyFilePath(filePath)) {}

void print(std::string_view const message, Context const & context, const char * function = "", const char * filePath = "", int line = 0)
void print(std::string_view const message, Context const & context)
{
// config is shared state, must synchronize access
auto lock = std::unique_lock{mutex};
Expand Down

0 comments on commit b549f2a

Please sign in to comment.