Public Member Functions | Private Member Functions | Private Attributes | List of all members
stan::test::unit::instrumented_logger Class Reference

#include "test/unit/services/instrumented_callbacks.hpp"

Inheritance diagram for stan::test::unit::instrumented_logger:
stan::callbacks::logger

Public Member Functions

 instrumented_logger ()
 
void debug (const std::string &message)
 
void debug (const std::stringstream &message)
 
void info (const std::string &message)
 
void info (const std::stringstream &message)
 
void warn (const std::string &message)
 
void warn (const std::stringstream &message)
 
void error (const std::string &message)
 
void error (const std::stringstream &message)
 
void fatal (const std::string &message)
 
void fatal (const std::stringstream &message)
 
unsigned int call_count ()
 
unsigned int call_count_debug ()
 
unsigned int call_count_info ()
 
unsigned int call_count_warn ()
 
unsigned int call_count_error ()
 
unsigned int call_count_fatal ()
 
unsigned int find_debug (const std::string &msg)
 
unsigned int find_info (const std::string &msg)
 
unsigned int find_warn (const std::string &msg)
 
unsigned int find_error (const std::string &msg)
 
unsigned int find_fatal (const std::string &msg)
 
unsigned int find (const std::string &msg)
 
void print_info (std::ostream &o)
 

Private Member Functions

unsigned int find_ (const std::vector< std::string > &vec, const std::string &msg)
 

Private Attributes

std::vector< std::stringdebug_
 
std::vector< std::stringinfo_
 
std::vector< std::stringwarn_
 
std::vector< std::stringerror_
 
std::vector< std::stringfatal_
 

Detailed Description

instrumented_logger counts the number of times it is called through each route and makes the count available via methods. Stores all arguments passed and makes them available via methods.

Definition at line 166 of file instrumented_callbacks.hpp.

Constructor & Destructor Documentation

stan::test::unit::instrumented_logger::instrumented_logger ( )
inline

Definition at line 168 of file instrumented_callbacks.hpp.

168 {}

Member Function Documentation

unsigned int stan::test::unit::instrumented_logger::call_count ( )
inline

Definition at line 211 of file instrumented_callbacks.hpp.

Referenced by TEST(), and TEST_F().

211  {
212  return debug_.size() + info_.size() + warn_.size()
213  + error_.size() + fatal_.size();
214  }
unsigned int stan::test::unit::instrumented_logger::call_count_debug ( )
inline

Definition at line 216 of file instrumented_callbacks.hpp.

216  {
217  return debug_.size();
218  }
unsigned int stan::test::unit::instrumented_logger::call_count_error ( )
inline

Definition at line 228 of file instrumented_callbacks.hpp.

Referenced by TEST_F().

228  {
229  return error_.size();
230  }
unsigned int stan::test::unit::instrumented_logger::call_count_fatal ( )
inline

Definition at line 232 of file instrumented_callbacks.hpp.

232  {
233  return fatal_.size();
234  }
unsigned int stan::test::unit::instrumented_logger::call_count_info ( )
inline

Definition at line 220 of file instrumented_callbacks.hpp.

Referenced by TEST(), and TEST_F().

220  {
221  return info_.size();
222  }
unsigned int stan::test::unit::instrumented_logger::call_count_warn ( )
inline

Definition at line 224 of file instrumented_callbacks.hpp.

224  {
225  return warn_.size();
226  }
void stan::test::unit::instrumented_logger::debug ( const std::string message)
inlinevirtual

Logs a message with debug log level

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 170 of file instrumented_callbacks.hpp.

170  {
171  debug_.push_back(message);
172  }
void stan::test::unit::instrumented_logger::debug ( const std::stringstream &  message)
inlinevirtual

Logs a message with debug log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 174 of file instrumented_callbacks.hpp.

174  {
175  debug_.push_back(message.str());
176  }
void stan::test::unit::instrumented_logger::error ( const std::string message)
inlinevirtual

Logs an error with error log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 194 of file instrumented_callbacks.hpp.

194  {
195  error_.push_back(message);
196  }
void stan::test::unit::instrumented_logger::error ( const std::stringstream &  message)
inlinevirtual

Logs an error with error log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 198 of file instrumented_callbacks.hpp.

198  {
199  error_.push_back(message.str());
200  }
void stan::test::unit::instrumented_logger::fatal ( const std::string message)
inlinevirtual

Logs an error with fatal log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 202 of file instrumented_callbacks.hpp.

202  {
203  fatal_.push_back(message);
204  }
void stan::test::unit::instrumented_logger::fatal ( const std::stringstream &  message)
inlinevirtual

Logs an error with fatal log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 206 of file instrumented_callbacks.hpp.

206  {
207  fatal_.push_back(message.str());
208  }
unsigned int stan::test::unit::instrumented_logger::find ( const std::string msg)
inline

Definition at line 256 of file instrumented_callbacks.hpp.

256  {
257  return find_debug(msg) + find_info(msg) + find_warn(msg)
259  }
unsigned int find_fatal(const std::string &msg)
unsigned int find_warn(const std::string &msg)
unsigned int find_error(const std::string &msg)
unsigned int find_info(const std::string &msg)
unsigned int find_debug(const std::string &msg)
unsigned int stan::test::unit::instrumented_logger::find_ ( const std::vector< std::string > &  vec,
const std::string msg 
)
inlineprivate

Definition at line 267 of file instrumented_callbacks.hpp.

References confusionMatrixTree::count, and getGoodRuns4SAM::n.

267  {
268  unsigned int count = 0;
269  for (size_t n = 0; n < vec.size(); ++n)
270  if (vec[n].find(msg) != std::string::npos)
271  count++;
272  return count;
273  }
Eigen::VectorXd vec
unsigned int find(const std::string &msg)
unsigned int stan::test::unit::instrumented_logger::find_debug ( const std::string msg)
inline

Definition at line 236 of file instrumented_callbacks.hpp.

236  {
237  return find_(debug_, msg);
238  }
unsigned int find_(const std::vector< std::string > &vec, const std::string &msg)
unsigned int stan::test::unit::instrumented_logger::find_error ( const std::string msg)
inline

Definition at line 248 of file instrumented_callbacks.hpp.

248  {
249  return find_(error_, msg);
250  }
unsigned int find_(const std::vector< std::string > &vec, const std::string &msg)
unsigned int stan::test::unit::instrumented_logger::find_fatal ( const std::string msg)
inline

Definition at line 252 of file instrumented_callbacks.hpp.

252  {
253  return find_(fatal_, msg);
254  }
unsigned int find_(const std::vector< std::string > &vec, const std::string &msg)
unsigned int stan::test::unit::instrumented_logger::find_info ( const std::string msg)
inline

Definition at line 240 of file instrumented_callbacks.hpp.

Referenced by TEST(), and TEST_F().

240  {
241  return find_(info_, msg);
242  }
unsigned int find_(const std::vector< std::string > &vec, const std::string &msg)
unsigned int stan::test::unit::instrumented_logger::find_warn ( const std::string msg)
inline

Definition at line 244 of file instrumented_callbacks.hpp.

244  {
245  return find_(warn_, msg);
246  }
unsigned int find_(const std::vector< std::string > &vec, const std::string &msg)
void stan::test::unit::instrumented_logger::info ( const std::string message)
inlinevirtual

Logs a message with info log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 178 of file instrumented_callbacks.hpp.

178  {
179  info_.push_back(message);
180  }
void stan::test::unit::instrumented_logger::info ( const std::stringstream &  message)
inlinevirtual

Logs a message with info log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 182 of file instrumented_callbacks.hpp.

182  {
183  info_.push_back(message.str());
184  }
void stan::test::unit::instrumented_logger::print_info ( std::ostream &  o)
inline

Definition at line 261 of file instrumented_callbacks.hpp.

References allTimeWatchdog::endl, and getGoodRuns4SAM::n.

261  {
262  for (size_t n = 0; n < info_.size(); ++n)
263  o << info_[n] << std::endl;
264  }
void stan::test::unit::instrumented_logger::warn ( const std::string message)
inlinevirtual

Logs a message with warn log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 186 of file instrumented_callbacks.hpp.

186  {
187  warn_.push_back(message);
188  }
void stan::test::unit::instrumented_logger::warn ( const std::stringstream &  message)
inlinevirtual

Logs a message with warn log level.

Parameters
[in]messagemessage

Reimplemented from stan::callbacks::logger.

Definition at line 190 of file instrumented_callbacks.hpp.

190  {
191  warn_.push_back(message.str());
192  }

Member Data Documentation

std::vector<std::string> stan::test::unit::instrumented_logger::debug_
private

Definition at line 276 of file instrumented_callbacks.hpp.

std::vector<std::string> stan::test::unit::instrumented_logger::error_
private

Definition at line 279 of file instrumented_callbacks.hpp.

std::vector<std::string> stan::test::unit::instrumented_logger::fatal_
private

Definition at line 280 of file instrumented_callbacks.hpp.

std::vector<std::string> stan::test::unit::instrumented_logger::info_
private

Definition at line 277 of file instrumented_callbacks.hpp.

std::vector<std::string> stan::test::unit::instrumented_logger::warn_
private

Definition at line 278 of file instrumented_callbacks.hpp.


The documentation for this class was generated from the following file: