DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ers.hpp
Go to the documentation of this file.
1/*
2 * ers.h
3 * ers
4 *
5 * Created by Matthias Wiesmann on 26.01.05.
6 * Modified by Serguei Kolos on 26.08.05.
7 * Copyright 2005 CERN. All rights reserved.
8 *
9 */
10
17#ifndef ERS_ERS_H
18#define ERS_ERS_H
19
20#include <sys/resource.h>
21#include <functional>
22#include <sstream>
23#include <ers/StreamManager.hpp>
24#include <ers/Configuration.hpp>
25#include <ers/Issue.hpp>
26#include <ers/Assertion.hpp>
27#include <ers/Severity.hpp>
28#include <ers/LocalStream.hpp>
29
30#include <boost/preprocessor/logical/not.hpp>
31#include <boost/preprocessor/punctuation/comma_if.hpp>
32#include <boost/preprocessor/facilities/is_empty.hpp>
33
38namespace ers
39{
41
59 inline IssueCatcherHandler *
60 set_issue_catcher( const std::function<void ( const ers::Issue & )> & catcher )
61 { return LocalStream::instance().set_issue_catcher( catcher ); }
62
66 inline int debug_level( )
68
74 inline void debug( const Issue & issue, int level = debug_level() )
75 { StreamManager::instance().debug( issue, level ); }
76
81 inline void error( const Issue & issue )
82 { LocalStream::instance().error( issue ); }
83
88 inline void fatal( const Issue & issue )
89 { LocalStream::instance().fatal( issue ); }
90
95 inline void info( const Issue & issue )
97
102 inline void log( const Issue & issue )
103 { StreamManager::instance().log( issue ); }
104
108 inline int verbosity_level( )
110
115 inline void warning( const Issue & issue )
116 { LocalStream::instance().warning( issue ); }
117
118 inline int enable_core_dump() {
119 rlimit core_limit = { RLIM_INFINITY, RLIM_INFINITY };
120 return setrlimit( RLIMIT_CORE, &core_limit );
121 }
122}
123
124// ERS_DECLARE_ISSUE( ers, Message, ERS_EMPTY, ERS_EMPTY )
125
126#define ERS_REPORT_IMPL( stream, issue, message, level ) \
127{ \
128 std::ostringstream ers_report_impl_out_buffer; \
129 ers_report_impl_out_buffer << message; \
130 stream( issue( ERS_HERE, ers_report_impl_out_buffer.str() ) \
131 BOOST_PP_COMMA_IF( BOOST_PP_NOT( ERS_IS_EMPTY( ERS_EMPTY level ) ) ) level ); \
132}
133
134#endif // ERS_ERS_H
135
int verbosity_level() const
returns current verbosity level
static Configuration & instance()
return the singleton
int debug_level() const
returns current debug level
Implements issue catcher lifetime management.
Base class for any user define issue.
Definition Issue.hpp:69
static StreamManager & instance()
return the singleton
void log(const Issue &issue)
sends an issue to the log stream
void debug(const Issue &issue, int level)
sends an Issue to the debug stream
void information(const Issue &issue)
sends an issue to the information stream
int verbosity_level()
Definition ers.hpp:108
int debug_level()
Definition ers.hpp:66
void warning(const Issue &issue)
Definition ers.hpp:115
void info(const Issue &issue)
Definition ers.hpp:95
void log(const Issue &issue)
Definition ers.hpp:102
IssueCatcherHandler * set_issue_catcher(const std::function< void(const ers::Issue &)> &catcher)
Definition ers.hpp:60
Issue Exception
Definition ers.hpp:40
void debug(const Issue &issue, int level=debug_level())
Definition ers.hpp:74
void fatal(const Issue &issue)
Definition ers.hpp:88
int enable_core_dump()
Definition ers.hpp:118
Factory couldn t std::string alg_name Invalid configuration error
Definition Issues.hpp:34