1
0
Fork 0
arangodb/lib/Logger/LoggerInfo.cpp

152 lines
5.0 KiB
C++

////////////////////////////////////////////////////////////////////////////////
/// @brief logger info
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Achim Brandt
/// @author Copyright 2007-2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "LoggerInfo.h"
using namespace triagens::basics;
using namespace std;
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Logging
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief constructs a logger info
////////////////////////////////////////////////////////////////////////////////
LoggerInfo::LoggerInfo ()
: _info() {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destructs a logger info
////////////////////////////////////////////////////////////////////////////////
LoggerInfo::~LoggerInfo () {
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Logging
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief catches a prefix
////////////////////////////////////////////////////////////////////////////////
LoggerInfo& LoggerInfo::operator<< (string const& text) {
_info._prefix += text;
return *this;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief catches a peg
////////////////////////////////////////////////////////////////////////////////
LoggerInfo& LoggerInfo::operator<< (LoggerData::Peg const& peg) {
_info._peg = peg;
return *this;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief catches a task
////////////////////////////////////////////////////////////////////////////////
LoggerInfo& LoggerInfo::operator<< (LoggerData::Task const& task) {
_info._task = task;
return *this;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief catches an extra
////////////////////////////////////////////////////////////////////////////////
LoggerInfo& LoggerInfo::operator<< (LoggerData::Extra const& extra) {
if (extra._position == LoggerData::Extra::npos) {
_info._extras.push_back(extra);
size_t pos = _info._extras.size() - 1;
_info._extras[pos]._position = pos;
}
else {
if (_info._extras.size() <= extra._position) {
_info._extras.resize(extra._position + 1);
}
_info._extras[extra._position] = extra;
}
return *this;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief catches an user identifier
////////////////////////////////////////////////////////////////////////////////
LoggerInfo& LoggerInfo::operator<< (LoggerData::UserIdentifier const& userIdentifier) {
_info._userIdentifier = userIdentifier;
return *this;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief catches a position
////////////////////////////////////////////////////////////////////////////////
LoggerInfo& LoggerInfo::operator<< (LoggerData::Position const& position) {
_info._position = position;
return *this;
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End: