Commit d817994b authored by gabi's avatar gabi

Moved namespace fmt to be under spdlog::details to minimize namespace pollution for the users

parent 5cf9437a
This diff is collapsed.
...@@ -115,7 +115,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -115,7 +115,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ #define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \ TypeName(const TypeName&); \
void operator=(const TypeName&) void operator=(const TypeName&)
namespace spdlog {
namespace details {
namespace fmt namespace fmt
{ {
...@@ -2739,7 +2740,9 @@ inline void format_decimal(char *&buffer, T value) ...@@ -2739,7 +2740,9 @@ inline void format_decimal(char *&buffer, T value)
internal::format_decimal(buffer, abs_value, num_digits); internal::format_decimal(buffer, abs_value, num_digits);
buffer += num_digits; buffer += num_digits;
} }
} } // ns fmt
} // ns deatils
} // ns spdlog
#if FMT_GCC_VERSION #if FMT_GCC_VERSION
// Use the system_header pragma to suppress warnings about variadic macros // Use the system_header pragma to suppress warnings about variadic macros
...@@ -2846,6 +2849,8 @@ fmt::print(format, args...); ...@@ -2846,6 +2849,8 @@ fmt::print(format, args...);
#define FMT_VARIADIC_W(ReturnType, func, ...) \ #define FMT_VARIADIC_W(ReturnType, func, ...) \
FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__) FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__)
namespace spdlog {
namespace details {
namespace fmt namespace fmt
{ {
FMT_VARIADIC(std::string, format, StringRef) FMT_VARIADIC(std::string, format, StringRef)
...@@ -2858,6 +2863,8 @@ FMT_VARIADIC(std::string, sprintf, StringRef) ...@@ -2858,6 +2863,8 @@ FMT_VARIADIC(std::string, sprintf, StringRef)
FMT_VARIADIC(int, printf, StringRef) FMT_VARIADIC(int, printf, StringRef)
FMT_VARIADIC(int, fprintf, std::FILE *, StringRef) FMT_VARIADIC(int, fprintf, std::FILE *, StringRef)
} }
}
}
// Restore warnings. // Restore warnings.
#if FMT_GCC_VERSION >= 406 #if FMT_GCC_VERSION >= 406
......
...@@ -582,8 +582,8 @@ inline void spdlog::pattern_formatter::format(details::log_msg& msg) ...@@ -582,8 +582,8 @@ inline void spdlog::pattern_formatter::format(details::log_msg& msg)
//write eol //write eol
msg.formatted << details::os::eol(); msg.formatted << details::os::eol();
} }
catch(const fmt::FormatError& e) catch(const details::fmt::FormatError& e)
{ {
throw spdlog_ex(fmt::format("formatting error while processing format string: {}", e.what())); throw spdlog_ex(details::fmt::format("formatting error while processing format string: {}", e.what()));
} }
} }
...@@ -99,7 +99,7 @@ protected: ...@@ -99,7 +99,7 @@ protected:
private: private:
static std::string calc_filename(const std::string& filename, std::size_t index, const std::string& extension) static std::string calc_filename(const std::string& filename, std::size_t index, const std::string& extension)
{ {
fmt::MemoryWriter w; details::fmt::MemoryWriter w;
if (index) if (index)
w.write("{}.{}.{}", filename, index, extension); w.write("{}.{}.{}", filename, index, extension);
else else
...@@ -196,7 +196,7 @@ private: ...@@ -196,7 +196,7 @@ private:
static std::string calc_filename(const std::string& basename, const std::string& extension) static std::string calc_filename(const std::string& basename, const std::string& extension)
{ {
std::tm tm = spdlog::details::os::localtime(); std::tm tm = spdlog::details::os::localtime();
fmt::MemoryWriter w; details::fmt::MemoryWriter w;
w.write("{}.{:04d}-{:02d}-{:02d}.{}", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, extension); w.write("{}.{:04d}-{:02d}-{:02d}.{}", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, extension);
return w.str(); return w.str();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment