24 #ifndef KALDI_BASE_KALDI_ERROR_H_ 25 #define KALDI_BASE_KALDI_ERROR_H_ 1 39 #define __func__ __FUNCTION__ 92 : std::runtime_error(message) {}
96 virtual const char *
what() const noexcept
override {
97 return "kaldi::KaldiFatalError";
101 const char *
KaldiMessage()
const {
return std::runtime_error::what(); }
140 void LogMessage()
const;
148 ::kaldi::MessageLogger::LogAndThrow() = ::kaldi::MessageLogger( \ 149 ::kaldi::LogMessageEnvelope::kError, __func__, __FILE__, __LINE__) 151 ::kaldi::MessageLogger::Log() = ::kaldi::MessageLogger( \ 152 ::kaldi::LogMessageEnvelope::kWarning, __func__, __FILE__, __LINE__) 154 ::kaldi::MessageLogger::Log() = ::kaldi::MessageLogger( \ 155 ::kaldi::LogMessageEnvelope::kInfo, __func__, __FILE__, __LINE__) 156 #define KALDI_VLOG(v) \ 157 if ((v) <= ::kaldi::GetVerboseLevel()) \ 158 ::kaldi::MessageLogger::Log() = \ 159 ::kaldi::MessageLogger((::kaldi::LogMessageEnvelope::Severity)(v), \ 160 __func__, __FILE__, __LINE__) 185 #define KALDI_ASSERT(cond) \ 190 ::kaldi::KaldiAssertFailure_(__func__, __FILE__, __LINE__, #cond); \ 193 #define KALDI_ASSERT(cond) (void)0 197 #ifdef KALDI_PARANOID 198 #define KALDI_PARANOID_ASSERT(cond) \ 203 ::kaldi::KaldiAssertFailure_(__func__, __FILE__, __LINE__, #cond); \ 206 #define KALDI_PARANOID_ASSERT(cond) (void)0 213 const char *message);
231 #endif // KALDI_BASE_KALDI_ERROR_H_ This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
KaldiFatalError(const char *message)
const char * func
Name of the function invoking the logging.
MessageLogger & operator<<(const T &val)
const char * file
Source file name with up to 1 leading directory.
int32 GetVerboseLevel()
Get verbosity level, usually set via command line '–verbose=' switch.
void SetProgramName(const char *basename)
Called by ParseOptions to set base name (no directory) of the executing program.
void KaldiAssertFailure_(const char *func, const char *file, int32 line, const char *cond_str)
void(* LogHandler)(const LogMessageEnvelope &envelope, const char *message)
Type of third-party logging function.
Kaldi fatal runtime error exception.
LogMessageEnvelope envelope_
void SetVerboseLevel(int32 i)
This should be rarely used, except by programs using Kaldi as library; command-line programs set the ...
const char * KaldiMessage() const
Returns the Kaldi error message logged by KALDI_ERR.
KaldiFatalError(const std::string &message)
void operator=(const MessageLogger &logger)
Severity
Message severity.
LogHandler SetLogHandler(LogHandler handler)
Set logging handler.
std::string GetMessage() const
Fatal error. KaldiFatalError will be thrown.
int32 g_kaldi_verbose_level
This is set by util/parse-options.
void operator=(const MessageLogger &logger)
virtual const char * what() const noexcept override
Returns the exception name, "kaldi::KaldiFatalError".
Assertion failure. abort() will be called.
bool LocateSymbolRange(const std::string &trace_name, size_t *begin, size_t *end)
Indicates a recoverable but abnormal condition.
Log message severity and source location info.
int severity
A Severity value, or positive verbosity level.