DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
StreamManager.cpp File Reference
#include <assert.h>
#include <iostream>
#include <ers/Issue.hpp>
#include <ers/InputStream.hpp>
#include <ers/OutputStream.hpp>
#include <ers/StreamManager.hpp>
#include <ers/StreamFactory.hpp>
#include <ers/Severity.hpp>
#include <ers/Configuration.hpp>
#include <ers/ers.hpp>
#include <ers/internal/macro.hpp>
#include <ers/internal/Util.hpp>
#include <ers/internal/PluginManager.hpp>
#include <ers/internal/NullStream.hpp>
#include <ers/internal/SingletonCreator.hpp>
Include dependency graph for StreamManager.cpp:

Go to the source code of this file.

Classes

class  ers::StreamInitializer
 

Namespaces

namespace  ers
 

Functions

 ERS_DECLARE_ISSUE (ers, BadConfiguration, "The stream configuration string \""<< config<< "\" has syntax errors.",((std::string) config)) namespace
 

Function Documentation

◆ ERS_DECLARE_ISSUE()

ERS_DECLARE_ISSUE ( ers ,
BadConfiguration ,
"The stream configuration string \""<< config<< "\" has syntax errors." ,
((std::string) config)  )

This variable contains the default keys for building the default streams. The default is to use the default stream, in verbose mode for errors and fatals.

Definition at line 28 of file StreamManager.cpp.

34{
38 const char SEPARATOR = ',';
39
40 const char * const DefaultOutputStreams[] =
41 {
42 "lstdout", // Debug
43 "lstdout", // Log
44 "throttle,lstdout", // Information
45 "throttle,lstderr", // Warning
46 "throttle,lstderr", // Error
47 "lstderr" // Fatal
48 };
49
50 const char *
51 get_stream_description( ers::severity severity )
52 {
53 assert( ers::Debug <= severity && severity <= ers::Fatal );
54
55 std::string env_name( "DUNEDAQ_ERS_" );
56 env_name += ers::to_string( severity );
57 const char * env = ::getenv( env_name.c_str() );
58 return env ? env : DefaultOutputStreams[severity];
59 }
60
61 void
62 parse_stream_definition( const std::string & text,
63 std::vector<std::string> & result )
64 {
65 std::string::size_type start_p = 0, end_p = 0;
66 short brackets_open = 0;
67 while ( end_p < text.length() )
68 {
69 switch ( text[end_p] )
70 {
71 case '(':
72 ++brackets_open;
73 break;
74 case ')':
75 --brackets_open;
76 break;
77 case SEPARATOR:
78 if ( !brackets_open )
79 {
80 result.push_back( text.substr( start_p, end_p - start_p ) );
81 start_p = end_p + 1;
82 }
83 break;
84 default:
85 break;
86 }
87 end_p++;
88 }
89 if ( brackets_open )
90 {
91 throw ers::BadConfiguration( ERS_HERE, text );
92 }
93 if ( start_p != end_p )
94 {
95 result.push_back( text.substr( start_p, end_p - start_p ) );
96 }
97 }
98}
#define ERS_HERE
std::string to_string(severity s)
severity
Definition Severity.hpp:26
@ Debug
Definition Severity.hpp:26
@ Fatal
Definition Severity.hpp:26