QMCPACK
OutputManager.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2017 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, mdewing@anl.gov Argonne National Laboratory
8 //
9 // File created by: Mark Dewing, mdewing@anl.gov Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "OutputManager.h"
14 
15 
16 InfoStream infoSummary(&std::cout);
17 InfoStream infoLog(&std::cout);
18 InfoStream infoError(&std::cerr);
19 InfoStream infoDebug(&std::cout);
20 
21 // default verbosity is high for now. After converting to app_summary, the default will be low.
23 
24 
26 {
27  global_verbosity_level = level;
29  {
31  infoLog.resume();
32  infoDebug.resume();
33  }
34  else if (isActive(Verbosity::HIGH))
35  {
37  infoLog.resume();
38  infoDebug.pause();
39  }
40  else if (isActive(Verbosity::LOW))
41  {
43  infoLog.pause();
44  infoDebug.pause();
45  }
46 }
47 
48 bool OutputManagerClass::isActive(Verbosity level) const { return level <= global_verbosity_level; }
49 
51 {
53  infoLog.pause();
54 }
55 
57 {
59  infoLog.resume();
60 }
61 
63 {
65  infoLog.shutOff();
68 }
void pause()
Pause the summary and log streams.
Interface to output streams.
Definition: InfoStream.h:28
Verbosity
Definition: OutputManager.h:22
Declaration of OutputManager class.
InfoStream infoSummary
InfoStream infoDebug
void shutOff()
Permanently shut off all streams.
Verbosity global_verbosity_level
Definition: OutputManager.h:36
void resume()
Continue output on the stream used before pausing.
Definition: InfoStream.cpp:47
InfoStream infoLog
OutputManagerClass outputManager(Verbosity::HIGH)
void resume()
Resume the summary and log streams.
void shutOff()
Permanently turn off the stream.
Definition: InfoStream.cpp:53
InfoStream infoError
bool isActive(Verbosity level) const
void pause()
Stop output (redirect to a null stream)
Definition: InfoStream.cpp:41
void setVerbosity(Verbosity level)