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 <ers/Assertion.hpp>
32#include <ers/Configuration.hpp>
33#include <ers/Issue.hpp>
34#include <ers/LocalStream.hpp>
35#include <ers/Severity.hpp>
36#include <ers/StreamManager.hpp>
37#include <functional>
38#include <sstream>
39#include <sys/resource.h>
40
41#include <boost/preprocessor/facilities/is_empty.hpp>
42#include <boost/preprocessor/logical/not.hpp>
43#include <boost/preprocessor/punctuation/comma_if.hpp>
44
48
49namespace ers {
51
56
70inline IssueCatcherHandler*
71set_issue_catcher(const std::function<void(const ers::Issue&)>& catcher)
72{
73 return LocalStream::instance().set_issue_catcher(catcher);
74}
75
79inline int
84
90inline void
91debug(const Issue& issue, int level = debug_level())
92{
93 StreamManager::instance().debug(issue, level);
94}
95
100inline void
101error(const Issue& issue)
102{
103 LocalStream::instance().error(issue);
104}
105
110inline void
111fatal(const Issue& issue)
112{
113 LocalStream::instance().fatal(issue);
114}
115
120inline void
121info(const Issue& issue)
122{
124}
125
130inline void
131log(const Issue& issue)
132{
134}
135
139inline int
144
149inline void
150warning(const Issue& issue)
151{
152 LocalStream::instance().warning(issue);
153}
154
155inline int
157{
158 rlimit core_limit = { RLIM_INFINITY, RLIM_INFINITY };
159 return setrlimit(RLIMIT_CORE, &core_limit);
160}
161}
162
163// ERS_DECLARE_ISSUE( ers, Message, ERS_EMPTY, ERS_EMPTY )
164
165#define ERS_REPORT_IMPL(stream, issue, message, level) \
166 { \
167 std::ostringstream ers_report_impl_out_buffer; \
168 ers_report_impl_out_buffer << message; \
169 stream(issue(ERS_HERE, ers_report_impl_out_buffer.str()) \
170 BOOST_PP_COMMA_IF(BOOST_PP_NOT(ERS_IS_EMPTY(ERS_EMPTY level))) level); \
171 }
172
173#endif // ERS_ERS_H
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:76
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:140
int debug_level()
Definition ers.hpp:80
void warning(const Issue &issue)
Definition ers.hpp:150
void info(const Issue &issue)
Definition ers.hpp:121
void log(const Issue &issue)
Definition ers.hpp:131
IssueCatcherHandler * set_issue_catcher(const std::function< void(const ers::Issue &)> &catcher)
Definition ers.hpp:71
Issue Exception
Definition ers.hpp:50
void debug(const Issue &issue, int level=debug_level())
Definition ers.hpp:91
void fatal(const Issue &issue)
Definition ers.hpp:111
int enable_core_dump()
Definition ers.hpp:156
void error(const Issue &issue)
Definition ers.hpp:101