예제 #1
0
  // print out the given message to the output stream
  void print(Inform::Level_t l, const std::string &prefix, const char *msg)
  {
    if (shouldPrint(l))
      {
	// Print the prefix, if necessary.
        if (prefix.length() > 0)
          {
            // First print the base part of the prefix
            *stream_m << prefix;

            // If there are more than 1 contexts, insert the context ID
            // into the prefix:
            if (Inform::numContexts() > 1)
              {
                if ((outputContext_m == Inform::allContexts) ||
                    (outputContext_m == Inform::context()))
                  {
                    *stream_m << "{" << Inform::context() << "}";
                  }
              }

            // Add on the "> ":
            *stream_m << "> ";
          }

        // Then print the rest of the message and flush the stream
        *stream_m << msg << "\n";
        stream_m->flush();
      }
  }
예제 #2
0
파일: Writer.cpp 프로젝트: 00liujj/trilinos
Writer &
Writer::operator<<(
  std::ios_base &       (*f)(std::ios_base&))
{
  if (shouldPrint())
    f(getStream());
  return *this;
}
예제 #3
0
파일: Writer.cpp 프로젝트: 00liujj/trilinos
/**
 * @brief Member function <b>pop</b> is a manipulator which decreases the line
 * mask depth by one, but not less than zero(0).
 *
 * @return      a <b>Writer</b> reference to this object
 */
Writer &
Writer::pop() {
  if (shouldPrint()) {
    getStream() << stk::pop;
    m_lineMaskStack.resetDepth().pop();
  }

  return *this;
}
예제 #4
0
파일: Writer.cpp 프로젝트: 00liujj/trilinos
/**
 * @brief Member function <b>push</b> is a manipulator which increases the line
 * mask depth by one.
 *
 * @return      a <b>Writer</b> reference to this object
 */
Writer &
Writer::push() {
  if (shouldPrint()) {
    m_lineMaskStack.pushDepth();
    getStream() << stk::push;
  }

  return *this;
}
예제 #5
0
파일: Writer.cpp 프로젝트: 00liujj/trilinos
/**
 * @brief Member function <b>dendl</b> is a manipulator which sets the output
 * stream to a new line.<P>
 *
 * The std::endl manipulator is sent to the output stream.
 *
 * @return      a <b>Writer</b> reference to this object
 */
Writer &
Writer::dendl() {
  if (shouldPrint())
    getStream() << std::endl;

  m_lineMaskStack.resetDepth();

  return *this;
}
예제 #6
0
/// Destructor, prints \b end-of-line before going down.
ContextRealLogger::~ContextRealLogger()
{
    if (shouldPrint()) {
        // The Trolls set STDERR to O_NONBLOCK, but ignores the EAGAIN
        // from write, so if your machine is heavily loaded and the
        // terminal can't keep up with our log messages you start to
        // lose them.  Hack: just set STDERR to block before every
        // debug message.
        fcntl(STDERR_FILENO, F_SETFL, O_WRONLY);
        appendFeatures();
        QTextStream::operator<<('\n');
        QTextStream(stderr) << data;
    }

    setDevice(NULL);
}
예제 #7
0
파일: Writer.hpp 프로젝트: 00liujj/trilinos
 /**
  * @brief Member function <b>shouldPrint</b> returns true if the line should print.
  *
  * @return      a <b>bool</b> of true if this line should be printed.
  */
 bool shouldPrint() {
   return shouldPrint(m_lineMaskStack.getLineMask());
 }