Line data Source code
1 : /*
2 : * DUNE DAQ modification notice:
3 : * This file has been modified from the original ATLAS ers source for the DUNE DAQ project.
4 : * Fork baseline commit: 8267df82a4f6fe6bf02c4014923eba19eddc4614 (2020-04-14).
5 : * Renamed since fork: yes (from src/Configuration.cxx to src/Configuration.cpp).
6 : *
7 : * Original copyright:
8 : * Copyright (C) 2001-2020 CERN for the benefit of the ATLAS collaboration.
9 : * Licensed under the Apache License, Version 2.0.
10 : */
11 :
12 : /*
13 : * Configuration.cxx
14 : * ERS
15 : *
16 : * Created by Serguei Kolos on 21.01.05.
17 : * Copyright 2005 CERN. All rights reserved.
18 : *
19 : */
20 : #include <cstdio>
21 : #include <iostream>
22 :
23 : #include <ers/Configuration.hpp>
24 : #include <ers/ers.hpp>
25 : #include <ers/internal/SingletonCreator.hpp>
26 : #include <ers/internal/Util.hpp>
27 :
28 : /** This method returns the singleton instance.
29 : * It should be used for every operation on the factory.
30 : * \return a reference to the singleton instance
31 : */
32 : ers::Configuration&
33 9985 : ers::Configuration::instance()
34 : {
35 : /**Singleton instance
36 : */
37 9985 : static ers::Configuration* instance = ers::SingletonCreator<ers::Configuration>::create();
38 :
39 9985 : return *instance;
40 : }
41 :
42 : /** Private constructor - can not be called by user code, use the \c instance() method instead
43 : * \see instance()
44 : */
45 46 : ers::Configuration::Configuration()
46 46 : : m_debug_level(0)
47 46 : , m_verbosity_level(0)
48 : {
49 46 : m_debug_level = read_from_environment("DUNEDAQ_ERS_DEBUG_LEVEL", m_debug_level);
50 46 : m_verbosity_level = read_from_environment("DUNEDAQ_ERS_VERBOSITY_LEVEL", m_verbosity_level);
51 46 : }
52 :
53 : void
54 0 : ers::Configuration::verbosity_level(int verbosity_level)
55 : {
56 0 : m_verbosity_level = verbosity_level;
57 0 : }
58 :
59 : std::ostream&
60 0 : ers::operator<<(std::ostream& out, const ers::Configuration& conf)
61 : {
62 0 : out << "debug level = " << conf.m_debug_level << " verbosity level = " << conf.m_verbosity_level;
63 0 : return out;
64 : }
|