|
TECA
The Toolkit for Extreme Climate Analysis
|
Go to the documentation of this file.
6 #include "teca_config.h"
62 std::ostream &
operator<<(std::ostream &os,
const std::vector<T> &vec)
67 size_t n = vec.size();
68 for (
size_t i = 1; i < n; ++i)
75 std::ostream &
operator<<(std::ostream &os,
const std::vector<std::string> &vec);
80 template <
typename num_t,
int len,
81 typename =
typename std::enable_if<!std::is_same<num_t,char>::value,
bool>::type>
82 std::ostream &
operator<<(std::ostream &os,
const num_t (& data)[len])
85 for (
int i = 1; i < len; ++i)
86 os <<
", " << data[i];
97 #define ANSI_RED "\033[1;31;40m"
98 #define ANSI_GREEN "\033[1;32;40m"
99 #define ANSI_YELLOW "\033[1;33;40m"
100 #define ANSI_WHITE "\033[1;37;40m"
101 #define ANSI_OFF "\033[0m"
103 #define BEGIN_HL(_color) (have_tty()?_color:"")
104 #define END_HL (have_tty()?ANSI_OFF:"")
112 #define TECA_MESSAGE(_strm, _head, _head_color, _msg) \
114 << BEGIN_HL(_head_color) << _head << END_HL \
115 << " " << teca_parallel_id() << " [" << __FILE__ << ":" << __LINE__ \
116 << " " << TECA_VERSION_DESCR << "]" << std::endl \
117 << BEGIN_HL(_head_color) << _head << END_HL << " " \
118 << BEGIN_HL(ANSI_WHITE) << "" _msg << END_HL << std::endl;
121 #define TECA_MESSAGE_RAW(_strm, _head, _msg) \
123 << _head << " " << teca_parallel_id() << " [" << __FILE__ \
124 << ":" << __LINE__ << " " << TECA_VERSION_DESCR << "]" << std::endl \
125 << _head << " " << "" _msg << std::endl;
130 #define TECA_FATAL_ERROR(_msg) \
132 std::ostringstream ess; \
133 TECA_MESSAGE(ess, "ERROR:", ANSI_RED, _msg) \
134 teca_error::error_handler(ess.str().c_str()); \
138 #define TECA_ERROR(_msg) TECA_MESSAGE(std::cerr, "ERROR:", ANSI_RED, _msg)
141 #define TECA_WARNING(_msg) TECA_MESSAGE(std::cerr, "WARNING:", ANSI_YELLOW, _msg)
144 #define TECA_STATUS(_msg) TECA_MESSAGE(std::cerr, "STATUS:", ANSI_GREEN, _msg)
global error handling hooks
Definition: teca_common.h:22
void set_error_message_abort_handler()
Install the teca_error::error_message_abort error handler.
void(*)(const char *) p_teca_error_handler
Definition: teca_common.h:19
void error_message(const char *msg)
void error_message_abort(const char *msg)
void set_error_message_handler()
Install the teca_error::error_message error handler.
p_teca_error_handler error_handler
The global error handler instance.
std::ostream & operator<<(std::ostream &os, const teca_calendar_util::time_point &tpt)
send the time_point to a stream in humnan readable form
void set_error_handler(p_teca_error_handler handler)