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.
#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
namespace spdlog {
namespace details {
namespace fmt
{
......@@ -1053,7 +1054,7 @@ public:
{
default:
assert(false);
// Fall through.
// Fall through.
case Arg::INT:
return FMT_DISPATCH(visit_int(arg.int_value));
case Arg::UINT:
......@@ -2222,7 +2223,7 @@ void BasicWriter<Char>::write_double(
// MSVC's printf doesn't support 'F'.
type = 'f';
#endif
// Fall through.
// Fall through.
case 'E':
case 'G':
case 'A':
......@@ -2739,7 +2740,9 @@ inline void format_decimal(char *&buffer, T value)
internal::format_decimal(buffer, abs_value, num_digits);
buffer += num_digits;
}
}
} // ns fmt
} // ns deatils
} // ns spdlog
#if FMT_GCC_VERSION
// Use the system_header pragma to suppress warnings about variadic macros
......@@ -2846,6 +2849,8 @@ fmt::print(format, args...);
#define FMT_VARIADIC_W(ReturnType, func, ...) \
FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__)
namespace spdlog {
namespace details {
namespace fmt
{
FMT_VARIADIC(std::string, format, StringRef)
......@@ -2858,6 +2863,8 @@ FMT_VARIADIC(std::string, sprintf, StringRef)
FMT_VARIADIC(int, printf, StringRef)
FMT_VARIADIC(int, fprintf, std::FILE *, StringRef)
}
}
}
// Restore warnings.
#if FMT_GCC_VERSION >= 406
......
......@@ -458,7 +458,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
{
switch (flag)
{
// logger name
// logger name
case 'n':
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
break;
......@@ -582,8 +582,8 @@ inline void spdlog::pattern_formatter::format(details::log_msg& msg)
//write 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:
private:
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)
w.write("{}.{}.{}", filename, index, extension);
else
......@@ -196,7 +196,7 @@ private:
static std::string calc_filename(const std::string& basename, const std::string& extension)
{
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);
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