DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ers.hpp
Go to the documentation of this file.
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 ers/ers.h to include/ers/ers.hpp).
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 * ers.h
14 * ers
15 *
16 * Created by Matthias Wiesmann on 26.01.05.
17 * Modified by Serguei Kolos on 26.08.05.
18 * Copyright 2005 CERN. All rights reserved.
19 *
20 */
21
27
28#ifndef ERS_ERS_H
29#define ERS_ERS_H
30
31#include <sys/resource.h>
32#include <functional>
33#include <sstream>
34#include <ers/StreamManager.hpp>
35#include <ers/Configuration.hpp>
36#include <ers/Issue.hpp>
37#include <ers/Assertion.hpp>
38#include <ers/Severity.hpp>
39#include <ers/LocalStream.hpp>
40
41#include <boost/preprocessor/logical/not.hpp>
42#include <boost/preprocessor/punctuation/comma_if.hpp>
43#include <boost/preprocessor/facilities/is_empty.hpp>
44
48
49namespace ers
50{
52
57
70 inline IssueCatcherHandler *
71 set_issue_catcher( const std::function<void ( const ers::Issue & )> & catcher )
72 { return LocalStream::instance().set_issue_catcher( catcher ); }
73
77 inline int debug_level( )
79
85 inline void debug( const Issue & issue, int level = debug_level() )
86 { StreamManager::instance().debug( issue, level ); }
87
92 inline void error( const Issue & issue )
93 { LocalStream::instance().error( issue ); }
94
99 inline void fatal( const Issue & issue )
100 { LocalStream::instance().fatal( issue ); }
101
106 inline void info( const Issue & issue )
108
113 inline void log( const Issue & issue )
114 { StreamManager::instance().log( issue ); }
115
119 inline int verbosity_level( )
121
126 inline void warning( const Issue & issue )
127 { LocalStream::instance().warning( issue ); }
128
129 inline int enable_core_dump() {
130 rlimit core_limit = { RLIM_INFINITY, RLIM_INFINITY };
131 return setrlimit( RLIMIT_CORE, &core_limit );
132 }
133}
134
135// ERS_DECLARE_ISSUE( ers, Message, ERS_EMPTY, ERS_EMPTY )
136
137#define ERS_REPORT_IMPL( stream, issue, message, level ) \
138{ \
139 std::ostringstream ers_report_impl_out_buffer; \
140 ers_report_impl_out_buffer << message; \
141 stream( issue( ERS_HERE, ers_report_impl_out_buffer.str() ) \
142 BOOST_PP_COMMA_IF( BOOST_PP_NOT( ERS_IS_EMPTY( ERS_EMPTY level ) ) ) level ); \
143}
144
145#endif // ERS_ERS_H
146
int verbosity_level() const
returns current verbosity level
static Configuration & instance()
return the singleton
int debug_level() const
returns current debug level
Base class for any user define issue.
Definition Issue.hpp:80
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:119
int debug_level()
Definition ers.hpp:77
void warning(const Issue &issue)
Definition ers.hpp:126
void info(const Issue &issue)
Definition ers.hpp:106
void log(const Issue &issue)
Definition ers.hpp:113
IssueCatcherHandler * set_issue_catcher(const std::function< void(const ers::Issue &)> &catcher)
Definition ers.hpp:71
Issue Exception
Definition ers.hpp:51
void debug(const Issue &issue, int level=debug_level())
Definition ers.hpp:85
void fatal(const Issue &issue)
Definition ers.hpp:99
int enable_core_dump()
Definition ers.hpp:129
Factory couldn t std::string alg_name Invalid configuration error
Definition Issues.hpp:34