Sierra Toolkit Version of the Day
SlibDiagWriter.cpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2004 - 2009 Sandia Corporation.                       */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #include <stk_util/util/Bootstrap.hpp>
00010 
00011 #include <stk_util/environment/OutputLog.hpp>
00012 #include <stk_util/diag/WriterRegistry.hpp>
00013 
00014 #include <stk_util/diag/SlibDiagWriter.hpp>
00015 
00016 namespace sierra {
00017 namespace Slib {
00018 
00026 class DiagWriterParser : public Diag::WriterParser
00027 {
00028 public:
00033   DiagWriterParser() {
00034     /* %TRACE[NONE]% */  /* %TRACE% */
00035 
00036     mask("resources", (Diag::PrintMask) (LOG_RESOURCE), "Display resource assignments");
00037     mask("plugins", (Diag::PrintMask) (LOG_PLUGIN), "Display plugin information");
00038     mask("global-variables", (Diag::PrintMask) (LOG_GLOBAL_VARIABLE), "Display global variable operations");
00039     mask("memory", (Diag::PrintMask) (LOG_MEMORY), "Display platform specific memory usage information");
00040   }
00041 };
00042 
00043 DiagWriterParser &
00044 theDiagWriterParser()
00045 {
00046   static DiagWriterParser parser;
00047 
00048   return parser;
00049 }
00050 
00051 stk::diag::Writer &
00052 theDiagWriter()
00053 {
00054   /* %TRACE[NONE]% */  /* %TRACE% */
00055   static stk::diag::Writer s_diagWriter(sierra::dwout().rdbuf(), theDiagWriterParser().parse(std::getenv("SIERRA_SLIBOUT")));
00056 
00057   return s_diagWriter;
00058 }
00059 
00060 
00061 namespace {
00062 
00063 void bootstrap()
00064 {
00065   Diag::registerWriter("slibout", slibout, theDiagWriterParser());
00066 }
00067 
00068 stk::Bootstrap x(&bootstrap);
00069 
00070 } // namespace <unnamed>
00071 
00072 } // namespace Slib
00073 } // namespace sierra
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines