1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00
Files
mariadb-columnstore-engine/dbcon/joblist/jl_logger.cpp
Roman Nozdrin 4fe9cd64a3 Revert "No boost condition (#2822)" (#2828)
This reverts commit f916e64927.
2023-04-22 15:49:50 +03:00

81 lines
2.1 KiB
C++

/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/*
* $Id: jl_logger.cpp 9210 2013-01-21 14:10:42Z rdempsey $
*/
#include <string>
using namespace std;
#include <boost/thread/mutex.hpp>
#include "messageobj.h"
#include "messageids.h"
#include "loggingid.h"
using namespace logging;
#include "jl_logger.h"
namespace
{
boost::mutex logMutex;
};
namespace joblist
{
Logger::Logger() : fLogId(5), fImpl(new logging::Logger(5))
{
MsgMap msgMap;
msgMap[LogDefaultMsg] = Message(LogDefaultMsg);
msgMap[LogSQLTrace] = Message(LogSQLTrace);
msgMap[LogNoPrimProcs] = Message(LogNoPrimProcs);
msgMap[LogMakeJobList] = Message(LogMakeJobList);
msgMap[LogRDRequest] = Message(LogRDRequest);
msgMap[LogRDRequestWait] = Message(LogRDRequestWait);
msgMap[LogRDReturn] = Message(LogRDReturn);
msgMap[LogRMResourceChange] = Message(LogRMResourceChange);
msgMap[LogRMResourceChangeError] = Message(LogRMResourceChangeError);
fImpl->msgMap(msgMap);
}
void catchHandler(const string& ex, int c, SErrorInfo& ei, unsigned sid, logging::LOG_TYPE level)
{
boost::mutex::scoped_lock lk(logMutex);
if (ei->errCode == 0)
{
ei->errMsg = ex;
ei->errCode = c;
}
Logger log;
log.setLoggingSession(sid);
log.logMessage(level, ex);
}
const string Logger::logMessage(logging::LOG_TYPE logLevel, unsigned idbErrorCode)
{
string errMsg = logging::IDBErrorInfo::instance()->errorMsg(idbErrorCode);
logMessage(logLevel, errMsg);
return errMsg;
}
} // namespace joblist