Message.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // INCLUDE
3 // ============================================================================
4 #include "Messages.h"
5 // ============================================================================
6 // BOOST:
7 // ============================================================================
8 #include <boost/format.hpp>
9 // ============================================================================
10 // Namespaces:
11 // ============================================================================
12 namespace gp = Gaudi::Parsers;
13 // ============================================================================
14 // ============================================================================
15 void gp::Messages::AddMessage(MSG::Level level,
16  const std::string& message) {
17  stream_ << level << message << endmsg;
18 }
19 // ============================================================================
20 void gp::Messages::AddMessage(MSG::Level level,
21  const Position& pos, const std::string& message) {
22  if (pos.filename() != m_currentFilename) {
23  stream_ << level << "# =======> " << pos.filename() << endmsg;
24  m_currentFilename = pos.filename();
25  }
26  stream_ << level << "# "
27  << boost::format("(%1%,%2%): %3%") % pos.line() % pos.column() % message
28  << endmsg;
29 }
30 // ============================================================================
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
unsigned column() const
Definition: Position.h:19
unsigned line() const
Definition: Position.h:18
const std::string & filename() const
Definition: Position.h:17
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120