Go to the documentation of this file.
46 std::ios_base::openmode mode)
50 init(filename, node, mode);
66 init(filename, this_node, std::ios::out);
75 init(filename, node, std::ios::out);
80 std::ios_base::openmode mode)
89 if( this_node != node) {
94 if (filename ==
"stdout") {
95 os_ =
new std::ostream(std::cout.rdbuf());
97 os_ =
new std::ofstream(filename.c_str(), mode);
101 fprintf(stderr,
"%s: init: unable to open log file \"%s\".\n",
class_name.c_str(), filename.c_str());
114 init(ost, this_node);
130 os_ =
new std::ostream(ost.rdbuf());
133 fprintf(stderr,
"%s: init: unable to open stream.\n",
class_name.c_str());
185 std::ostream *otmp =
stack_.top().os;
186 if (otmp)
delete otmp;
199 if ((str ==
"Crucial") || (str ==
"crucial") || (str ==
"CRUCIAL"))
return Bridge::CRUCIAL;
201 if ((str ==
"General") || (str ==
"general") || (str ==
"GENERAL"))
return Bridge::GENERAL;
203 if ((str ==
"Detailed") || (str ==
"detailed") || (str ==
"DETAILED"))
return Bridge::DETAILED;
205 if ((str ==
"Paranoiac") || (str ==
"paranoiac") || (str ==
"PARANOIAC"))
return Bridge::PARANOIAC;
252 va_start(arg, format);
255 if(
os_ ) *
os_ << std::flush;
272 va_start(arg, format);
291 va_start(arg, format);
310 va_start(arg, format);
328 va_start(arg, format);
346 va_start(arg, format);
363 va_start(arg, format);
380 va_start(arg, format);
398 va_start(arg, format);
408 "BridgeIO::curical: the stream is open for rank %d but specified %d\n",
428 va_start(arg, format);
435 "BridgeIO::general: the stream is open for rank %d but specified %d\n",
454 va_start(arg, format);
461 "BridgeIO::detailed: the stream is open for rank %d but specified %d\n",
480 va_start(arg, format);
487 "BridgeIO::paranoiac: the stream is open for rank %d but specified %d\n",
539 int node,
const char *format, va_list& arg)
541 if ((write_level <= level) && (Communicator::nodeid() == node)) {
543 std::cerr <<
"ERROR: BridgeIO: no output stream." << std::endl;
547 vsprintf(
buff_, format, arg);
559 std::cerr <<
"ERROR: BridgeIO: output failed." << std::endl;
void init(const std::string &filename)
void set_indent(const int level)
BridgeIO for output under parallel environment with verbose level control.
static int self()
rank within small world.
void detailed(const char *format,...)
void paranoiac(const char *format,...)
std::stack< os_info > stack_
static const std::string class_name
static Bridge::VerboseLevel Vlevel()
static VerboseLevel set_verbose_level(const std::string &str)
BridgeIO(const std::string &filename="stdout")
static int m_indent_level
void crucial(const char *format,...)
static int get_thread_id()
returns thread id.
std::ostream & getStream()
void print(VerboseLevel level, VerboseLevel write_level, int node, const char *format, va_list &arg)
void general(const char *format,...)
static void assert_single_thread(const std::string &class_name)
assert currently running on single thread.
static std::string get_verbose_level(const VerboseLevel vl)