The Gaudi Framework  v40r0 (475e45c1)
MsgStream.cpp File Reference
#include <GaudiKernel/GaudiException.h>
#include <GaudiKernel/IMessageSvc.h>
#include <GaudiKernel/Message.h>
#include <GaudiKernel/MsgStream.h>
#include <cstdarg>
#include <cstdio>
#include <iostream>
Include dependency graph for MsgStream.cpp:

Go to the source code of this file.

Functions

std::string format (const char *fmt,...)
 MsgStream format utility "a la sprintf(...)". More...
 

Function Documentation

◆ format()

std::string format ( const char *  fmt,
  ... 
)

MsgStream format utility "a la sprintf(...)".

Definition at line 99 of file MsgStream.cpp.

99  {
100  const int buffsize = 2048;
101  static char buffer[buffsize];
102  va_list arguments;
103  va_start( arguments, fmt );
104  if ( vsnprintf( buffer, buffsize, fmt, arguments ) >= buffsize ) {
105  va_end( arguments );
106  throw GaudiException( "Insufficient buffer size (" + std::to_string( buffsize ) + ") when formatting message",
107  "MsgStream", StatusCode::FAILURE );
108  }
109  va_end( arguments );
110  return std::string( buffer );
111 }
GaudiException
Definition: GaudiException.h:29
fmt
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100