0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::log: Simplify log class member interface.

This commit is contained in:
Jason Volk 2019-07-19 17:15:47 -07:00
parent 3185653ce0
commit 0704625401
2 changed files with 10 additions and 192 deletions

View file

@ -95,56 +95,6 @@ struct ircd::log::log
public:
template<class... args> void operator()(const level &, const string_view &fmt, args&&...);
#if RB_LOG_LEVEL >= 0 && !defined(NDEBUG) && !defined(RB_ASSERT)
template<class... args> [[noreturn]] void critical(const string_view &fmt, args&&...);
#elif RB_LOG_LEVEL >= 0
template<class... args> void critical(const string_view &fmt, args&&...);
#else
void critical(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 1
template<class... args> void error(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void error(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 2
template<class... args> void warning(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void warning(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 3
template<class... args> void notice(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void notice(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 4
template<class... args> void info(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void info(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 5
template<class... args> void derror(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void derror(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 6
template<class... args> void dwarning(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void dwarning(const string_view &fmt, ...);
#endif
#if RB_LOG_LEVEL >= 7
template<class... args> void debug(const string_view &fmt, args&&...);
#else // Required for DCE in gcc 6.3.0 20170519
void debug(const string_view &fmt, ...);
#endif
log(const string_view &name, const char &snote = '\0');
log(log &&) = delete;
log(const log &) = delete;
@ -551,146 +501,6 @@ struct ircd::log::critical
};
#endif
#if RB_LOG_LEVEL >= 7
template<class... args>
void
ircd::log::log::debug(const string_view &fmt,
args&&... a)
{
operator()(level::DEBUG, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::debug(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 6
template<class... args>
void
ircd::log::log::dwarning(const string_view &fmt,
args&&... a)
{
operator()(level::DWARNING, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::dwarning(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 5
template<class... args>
void
ircd::log::log::derror(const string_view &fmt,
args&&... a)
{
operator()(level::DERROR, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::derror(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 4
template<class... args>
void
ircd::log::log::info(const string_view &fmt,
args&&... a)
{
operator()(level::INFO, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::info(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 3
template<class... args>
void
ircd::log::log::notice(const string_view &fmt,
args&&... a)
{
operator()(level::NOTICE, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::notice(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 2
template<class... args>
void
ircd::log::log::warning(const string_view &fmt,
args&&... a)
{
operator()(level::WARNING, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::warning(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 1
template<class... args>
void
ircd::log::log::error(const string_view &fmt,
args&&... a)
{
operator()(level::ERROR, fmt, va_rtti{std::forward<args>(a)...});
}
#else
inline void
ircd::log::log::error(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
#if RB_LOG_LEVEL >= 0
template<class... args>
void
ircd::log::log::critical(const string_view &fmt,
args&&... a)
{
operator()(level::CRITICAL, fmt, va_rtti{std::forward<args>(a)...});
#ifndef NDEBUG
__assert_fail("critical", "", 0, "");
#endif
}
#else
inline void
ircd::log::log::critical(const string_view &fmt,
...)
{
// Required in gcc 6.3.0 20170519, template param packs are not DCE'ed
}
#endif
template<class... args>
void
ircd::log::log::operator()(const level &f,

View file

@ -2292,12 +2292,20 @@ const noexcept try
}
catch(const std::bad_function_call &e)
{
log.critical("merge: missing merge operator (%s)", e);
log::critical
{
log, "merge: missing merge operator (%s)", e
};
return false;
}
catch(const std::exception &e)
{
log.error("merge: %s", e);
log::error
{
log, "merge: %s", e
};
return false;
}