| helics 3.6.1

loggingHelper.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017-2025,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 #pragma once
8
9 #include "helics/helics-config.h"
10 #include "helics/helics_enums.h"
11
12 namespace helics {
20 #define LOG_ERROR(id, ident, message) sendToLogger(id, LogLevels::ERROR_LEVEL, ident, message)
21 #define LOG_ERROR_SIMPLE(message) \
22 sendToLogger(global_broker_id_local, LogLevels::ERROR_LEVEL, getIdentifier(), message)
23 #define LOG_WARNING(id, ident, message) sendToLogger(id, LogLevels::WARNING, ident, message)
24
25 #define LOG_WARNING_SIMPLE(message) \
26 sendToLogger(global_broker_id_local, LogLevels::WARNING, getIdentifier(), message)
27
28 #ifdef HELICS_ENABLE_LOGGING
29 # define LOG_SUMMARY(id, ident, message) \
30 if (maxLogLevel >= LogLevels::SUMMARY) { \
31 sendToLogger(id, LogLevels::SUMMARY, ident, message); \
32 }
33
34 # define LOG_CONNECTIONS(id, ident, message) \
35 if (maxLogLevel >= LogLevels::CONNECTIONS) { \
36 sendToLogger(id, LogLevels::CONNECTIONS, ident, message); \
37 }
38
39 # define LOG_INTERFACES(id, ident, message) \
40 if (maxLogLevel >= LogLevels::INTERFACES) { \
41 sendToLogger(id, LogLevels::INTERFACES, ident, message); \
42 }
43
44 # ifdef HELICS_ENABLE_DEBUG_LOGGING
45 # define LOG_TIMING(id, ident, message) \
46 if (maxLogLevel >= LogLevels::TIMING) { \
47 sendToLogger(id, LogLevels::TIMING, ident, message); \
48 }
49 # define LOG_DATA_MESSAGES(id, ident, message) \
50 if (maxLogLevel >= LogLevels::DATA) { \
51 sendToLogger(id, LogLevels::DATA, ident, message); \
52 }
53 # define LOG_DEBUG_MESSAGES(id, ident, message) \
54 if (maxLogLevel >= LogLevels::DEBUG) { \
55 sendToLogger(id, LogLevels::DEBUG, ident, message); \
56 }
57 # else
58 # define LOG_TIMING(id, ident, message)
59 # define LOG_DATA_MESSAGES(id, ident, message)
60 # define LOG_DEBUG_MESSAGES(id, ident, message)
61 # endif
62
63 # ifdef HELICS_ENABLE_TRACE_LOGGING
64 # define LOG_TRACE(id, ident, message) \
65 if (maxLogLevel >= LogLevels::TRACE) { \
66 sendToLogger(id, LogLevels::TRACE, ident, message); \
67 }
68 # else
69 # define LOG_TRACE(id, ident, message)
70 # endif
71 #else
72 # define LOG_SUMMARY(id, ident, message)
73 # define LOG_CONNECTIONS(id, ident, message)
74 # define LOG_INTERFACES(id, ident, message)
75 # define LOG_TIMING(id, ident, message)
76 # define LOG_DATA_MESSAGES(id, ident, message)
77 # define LOG_DEBUG_MESSAGES(id, ident, message)
78 # define LOG_TRACE(id, ident, message)
79 #endif
80 } // namespace helics
helics_enums.h
base helics enumerations for C and C++ API's
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14