The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
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(...)".
 

Function Documentation

◆ format()

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

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

Definition at line 93 of file MsgStream.cpp.

93 {
94 const int buffsize = 2048;
95 static char buffer[buffsize];
96 va_list arguments;
97 va_start( arguments, fmt );
98 if ( vsnprintf( buffer, buffsize, fmt, arguments ) >= buffsize ) {
99 va_end( arguments );
100 throw GaudiException( "Insufficient buffer size (" + std::to_string( buffsize ) + ") when formatting message",
101 "MsgStream", StatusCode::FAILURE );
102 }
103 va_end( arguments );
104 return std::string( buffer );
105}
Define general base for Gaudi exception.
constexpr static const auto FAILURE
Definition StatusCode.h:100