MsgStream.cpp File Reference
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/Message.h"
#include "GaudiKernel/GaudiException.h"
#include "GaudiKernel/IMessageSvc.h"
#include <iostream>
#include <cstdarg>
#include <cstdio>
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

#define KERNEL_MSGSTREAM_CPP

Definition at line 18 of file MsgStream.cpp.

Function Documentation

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

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

Definition at line 119 of file MsgStream.cpp.

120 {
121  const int buffsize = 2048;
122  static char buffer[buffsize];
123  va_list arguments;
124  va_start( arguments, fmt );
125  if( vsnprintf(buffer, buffsize, fmt, arguments) >= buffsize )
126  throw GaudiException("Insufficient buffer size (" + std::to_string(buffsize) + ") when formatting message",
127  "MsgStream", 0);
128  va_end( arguments );
129  return std::string(buffer);
130 }
Define general base for Gaudi exception.
T to_string(T...args)
STL class.
T vsnprintf(T...args)