1 #ifndef messagefacility_MessageLogger_MessageLogger_h 2 #define messagefacility_MessageLogger_MessageLogger_h 11 #include <type_traits> 90 return std::forward<NeverLogger_>(*this);
97 return std::forward<NeverLogger_>(*this);
101 operator<<(
std::ostream& (*)(
std::ostream&))
103 return std::forward<NeverLogger_>(*this);
106 operator<<(
std::ios_base& (*)(
std::ios_base&))
108 return std::forward<NeverLogger_>(*this);
112 template <ELseverityLevel::ELsev_ SEV,
bool VERBATIM>
121 if (msg_ ==
nullptr) {
139 int const line_number = 0)
144 auto const lastSlash =
file.find_last_of(
'/');
145 if ((lastSlash != std::string::npos) &&
146 (lastSlash != (
file.size() - 1))) {
150 msg_ = std::make_unique<ErrorObj>(
163 return std::forward<MaybeLogger_>(*this);
173 return std::forward<MaybeLogger_>(*this);
182 return std::forward<MaybeLogger_>(*this);
186 operator<<(
std::ios_base& (*
f)(
std::ios_base&))
191 return std::forward<MaybeLogger_>(*this);
195 std::unique_ptr<ErrorObj> msg_{
nullptr};
225 #define MF_LOG_INFO(category) \ 226 mf::LogInfo { category, __FILE__, __LINE__ } 227 #define MF_LOG_WARNING(category) \ 228 mf::LogWarning { category, __FILE__, __LINE__ } 229 #define MF_LOG_ERROR(category) \ 230 mf::LogError { category, __FILE__, __LINE__ } 231 #define MF_LOG_SYSTEM(category) \ 232 mf::LogSystem { category, __FILE__, __LINE__ } 236 #define MF_LOG_VERBATIM(category) \ 237 mf::LogVerbatim { category, __FILE__, __LINE__ } 238 #define MF_LOG_PRINT(category) \ 239 mf::LogPrint { category, __FILE__, __LINE__ } 240 #define MF_LOG_PROBLEM(category) \ 241 mf::LogProblem { category, __FILE__, __LINE__ } 242 #define MF_LOG_ABSOLUTE(category) \ 243 mf::LogAbsolute { category, __FILE__, __LINE__ } 245 #undef MF_SUPPRESS_LOG_DEBUG 249 #if defined(NDEBUG) || defined(MF_NDEBUG) 250 #define MF_SUPPRESS_LOG_DEBUG 251 #endif // NDEBUG || MF_NDEBUG 256 #undef MF_SUPPRESS_LOG_DEBUG 259 #ifdef MF_SUPPRESS_LOG_DEBUG 261 #define MF_LOG_DEBUG(id) \ 263 #define MF_LOG_TRACE(id) \ 266 #else // MF_SUPPRESS_LOG_DEBUG 268 #define MF_LOG_DEBUG(id) \ 269 mf::LogDebug { id, __FILE__, __LINE__ } 270 #define MF_LOG_TRACE(id) \ 271 mf::LogTrace { id, __FILE__, __LINE__ } 273 #endif // MF_SUPPRESS_LOG_DEBUG 275 #undef MF_SUPPRESS_LOG_DEBUG
void SetIteration(string const &val)
void SetHostAddr(string const &hostaddr)
void EndMessageFacility()
string const & GetModuleName()
MaybeLogger_(std::string const &category, std::string const &file={}, int const line_number=0)
void SetContextIteration(string const &val)
bool isMessageProcessingSetUp()
void StartMessageFacility(fhicl::ParameterSet const &pset, string const &applicationName)
void SetHostName(string const &hostname)
string const & GetHostName()
string const & GetIteration()
void SetContextSinglet(string const &val)
void LogErrorObj(ErrorObj *msg)
void SetModuleName(string const &val)
void SetApplicationName(string const &applicationName)
void SetPid(long const pid)
string const & GetApplicationName()
string const & GetHostAddr()