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

Go to the source code of this file.

Macros

#define KERNEL_MSGSTREAM_CPP
 

Functions

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

Macro Definition Documentation

◆ KERNEL_MSGSTREAM_CPP

#define KERNEL_MSGSTREAM_CPP

Definition at line 29 of file MsgStream.cpp.

Function Documentation

◆ format()

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

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

Definition at line 119 of file MsgStream.cpp.

119  {
120  const int buffsize = 2048;
121  static char buffer[buffsize];
122  va_list arguments;
123  va_start( arguments, fmt );
124  if ( vsnprintf( buffer, buffsize, fmt, arguments ) >= buffsize )
125  throw GaudiException( "Insufficient buffer size (" + std::to_string( buffsize ) + ") when formatting message",
126  "MsgStream", StatusCode::FAILURE );
127  va_end( arguments );
128  return std::string( buffer );
129 }
std::string
STL class.
GaudiException
Definition: GaudiException.h:31
std::to_string
T to_string(T... args)
fmt
std::vsnprintf
T vsnprintf(T... args)
va_list
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101