Sierra Toolkit  Version of the Day
SlibDiagWriter.cpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2004 - 2009 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <stk_util/util/Bootstrap.hpp>
10 
12 #include <stk_util/diag/WriterRegistry.hpp>
13 
14 #include <stk_util/diag/SlibDiagWriter.hpp>
15 
16 namespace sierra {
17 namespace Slib {
18 
26 class DiagWriterParser : public Diag::WriterParser
27 {
28 public:
33  DiagWriterParser() {
34  /* %TRACE[NONE]% */ /* %TRACE% */
35 
36  mask("resources", (Diag::PrintMask) (LOG_RESOURCE), "Display resource assignments");
37  mask("plugins", (Diag::PrintMask) (LOG_PLUGIN), "Display plugin information");
38  mask("global-variables", (Diag::PrintMask) (LOG_GLOBAL_VARIABLE), "Display global variable operations");
39  mask("memory", (Diag::PrintMask) (LOG_MEMORY), "Display platform specific memory usage information");
40  }
41 };
42 
43 DiagWriterParser &
44 theDiagWriterParser()
45 {
46  static DiagWriterParser parser;
47 
48  return parser;
49 }
50 
52 theDiagWriter()
53 {
54  /* %TRACE[NONE]% */ /* %TRACE% */
55  static stk_classic::diag::Writer s_diagWriter(sierra::dwout().rdbuf(), theDiagWriterParser().parse(std::getenv("SIERRA_SLIBOUT")));
56 
57  return s_diagWriter;
58 }
59 
60 
61 namespace {
62 
63 void bootstrap()
64 {
65  Diag::registerWriter("slibout", slibout, theDiagWriterParser());
66 }
67 
68 stk_classic::Bootstrap x(&bootstrap);
69 
70 } // namespace <unnamed>
71 
72 } // namespace Slib
73 } // namespace sierra
std::ostream & dwout()
Diagnostic writer stream.
Definition: OutputLog.cpp:690
Definition: Env.cpp:53
void registerWriter(const std::string &name, Writer &diag_writer, OptionMaskParser &option_parser)
Function registerWriter registers a diagnostic writer with the diagnostic writer registry.
void mask(const std::string &name, const Mask l_mask, const std::string &description)
Definition: Option.hpp:332
Class Writer implements a runtime selectable diagnostic output writer to aid in the development and d...
Definition: Writer.hpp:49
Class Bootstrap serves as a bootstrapping mechanism for products in the sierra toolkit and elsewhere...
Definition: Bootstrap.hpp:35