20#ifndef MS_LOG_IMPL_HPP
21#define MS_LOG_IMPL_HPP
25#if defined(_INTERNAL_USE_AND_HAVE_BOOST_FORMAT) || defined(DOXYGEN_SHOULD_SKIP_THIS)
27#include "boost/format.hpp"
29namespace matrix_science {
53void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1) {
56 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
57 boost::format fmter(unformattedMsg);
58 if (fmter.expected_args() == 1) {
60 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
62 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
76template <
typename T1,
typename T2>
77void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2) {
80 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
81 boost::format fmter(unformattedMsg);
82 if (fmter.expected_args() == 2) {
84 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
86 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
101template <
typename T1,
typename T2,
typename T3>
102void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3) {
105 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
106 boost::format fmter(unformattedMsg);
107 if (fmter.expected_args() == 3) {
108 fmter % arg1 %arg2 %arg3;
109 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
111 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
128template <
typename T1,
typename T2,
typename T3,
typename T4>
129void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3, T4 arg4) {
132 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
133 boost::format fmter(unformattedMsg);
134 if (fmter.expected_args() == 4) {
135 fmter % arg1 %arg2 %arg3 %arg4;
136 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
138 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
156template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
157void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) {
160 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
161 boost::format fmter(unformattedMsg);
162 if (fmter.expected_args() == 5) {
163 fmter % arg1 %arg2 %arg3 %arg4 %arg5;
164 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
166 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
184template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
185void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) {
188 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
189 boost::format fmter(unformattedMsg);
190 if (fmter.expected_args() == 6) {
191 fmter % arg1 %arg2 %arg3 %arg4 %arg5 %arg6;
192 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
194 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
213template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
214void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) {
217 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
218 boost::format fmter(unformattedMsg);
219 if (fmter.expected_args() == 7) {
220 fmter % arg1 %arg2 %arg3 %arg4 %arg5 %arg6 %arg7;
221 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
224 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
244template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
245void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) {
248 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
249 boost::format fmter(unformattedMsg);
250 if (fmter.expected_args() == 8) {
251 fmter % arg1 %arg2 %arg3 %arg4 %arg5 %arg6 %arg7 %arg8;
252 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
255 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
276template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
277void ms_log::logMessage(
ms_log::msg_num_t msgNum,
const char * srcFile,
const int lineNum, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) {
280 std::string unformattedMsg = _lookUpMsg(msgNum, severity);
281 boost::format fmter(unformattedMsg);
282 if (fmter.expected_args() == 9) {
283 fmter % arg1 %arg2 %arg3 %arg4 %arg5 %arg6 %arg7 %arg8 %arg9;
284 _setError(
static_cast<int>(msgNum), fmter.str().c_str(), severity,
"", -1, lineNum, srcFile);
287 _setError(
static_cast<int>(msgNum), unformattedMsg.c_str(), severity,
"", -1, lineNum, srcFile);
int msg_num_t
Typedef for log and error message numbers.
Definition: ms_log.hpp:127
bool willMessageBeLogged(const msg_num_t msgNum) const
Check to see if the message will be logged to a file or recorded anywhere.
Definition: ms_log.cpp:277
msg_sev
Message severity levels.
Definition: ms_log.hpp:47