proxygen
proxygen::StackTracePrinterWithException< T > Class Template Reference

#include <Logging.h>

Public Member Functions

 StackTracePrinterWithException (const bool checkPassed, const char *checkString, const char *file, const int line, const int logLevel)
 
std::ostream & stream ()
 
 ~StackTracePrinterWithException () noexcept(false)
 

Private Types

using StringStreamPair = std::pair< std::string, std::ostringstream >
 

Private Attributes

const char * file_
 
int line_
 
int logLevel_
 
std::unique_ptr< StringStreamPairtraceAndLogStreamPair_
 
folly::Optional< NullStreamnullStream_
 

Detailed Description

template<typename T>
class proxygen::StackTracePrinterWithException< T >

Definition at line 33 of file Logging.h.

Member Typedef Documentation

template<typename T >
using proxygen::StackTracePrinterWithException< T >::StringStreamPair = std::pair<std::string, std::ostringstream>
private

Definition at line 35 of file Logging.h.

Constructor & Destructor Documentation

template<typename T >
proxygen::StackTracePrinterWithException< T >::StackTracePrinterWithException ( const bool  checkPassed,
const char *  checkString,
const char *  file,
const int  line,
const int  logLevel 
)
inline

Definition at line 37 of file Logging.h.

References proxygen::logging_details::getStackTrace().

43  : file_(file),
44  line_(line),
45  logLevel_(logLevel) {
46  if (checkPassed) {
47  nullStream_.emplace();
48  } else {
49  traceAndLogStreamPair_ = std::make_unique<StringStreamPair>();
51  traceAndLogStreamPair_->second << checkString;
52  }
53  }
folly::Optional< NullStream > nullStream_
Definition: Logging.h:74
std::string getStackTrace()
Definition: Logging.cpp:159
std::unique_ptr< StringStreamPair > traceAndLogStreamPair_
Definition: Logging.h:73
template<typename T >
proxygen::StackTracePrinterWithException< T >::~StackTracePrinterWithException ( )
inlinenoexcept

Definition at line 60 of file Logging.h.

References T.

60  {
61  if (!nullStream_) {
62  google::LogMessage(file_, line_, logLevel_).stream()
63  << traceAndLogStreamPair_->second.str()
64  << "\nCall stack:\n"
65  << traceAndLogStreamPair_->first;
66  throw T(traceAndLogStreamPair_->second.str());
67  }
68  }
folly::Optional< NullStream > nullStream_
Definition: Logging.h:74
#define T(v)
Definition: http_parser.c:233
std::unique_ptr< StringStreamPair > traceAndLogStreamPair_
Definition: Logging.h:73

Member Function Documentation

template<typename T >
std::ostream& proxygen::StackTracePrinterWithException< T >::stream ( )
inline

Definition at line 54 of file Logging.h.

54  {
55  if (nullStream_) {
56  return nullStream_.value();
57  }
58  return traceAndLogStreamPair_->second;
59  }
folly::Optional< NullStream > nullStream_
Definition: Logging.h:74
std::unique_ptr< StringStreamPair > traceAndLogStreamPair_
Definition: Logging.h:73

Member Data Documentation

template<typename T >
const char* proxygen::StackTracePrinterWithException< T >::file_
private

Definition at line 70 of file Logging.h.

template<typename T >
int proxygen::StackTracePrinterWithException< T >::line_
private

Definition at line 71 of file Logging.h.

template<typename T >
int proxygen::StackTracePrinterWithException< T >::logLevel_
private

Definition at line 72 of file Logging.h.

template<typename T >
folly::Optional<NullStream> proxygen::StackTracePrinterWithException< T >::nullStream_
private

Definition at line 74 of file Logging.h.

template<typename T >
std::unique_ptr<StringStreamPair> proxygen::StackTracePrinterWithException< T >::traceAndLogStreamPair_
private

Definition at line 73 of file Logging.h.


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