Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:02

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2025-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Acts include(s).
0011 #include <Acts/Utilities/Logger.hpp>
0012 
0013 // detray include(s)
0014 #include <detray/utils/logging_streams.hpp>
0015 
0016 namespace traccc {
0017 
0018 /// Use the @c Acts::Logging namespace.
0019 namespace Logging = ::Acts::Logging;
0020 
0021 /// Use the @c Acts::Logger type.
0022 using Logger = ::Acts::Logger;
0023 
0024 /// Construct a logger with default settings for this project
0025 ///
0026 /// @param name the name of the log writer
0027 /// @param lvl the log level
0028 /// @param log_stream the stream to write the log to
0029 ///
0030 /// @return a unique pointer to the logger
0031 ///
0032 std::unique_ptr<const Logger> getDefaultLogger(
0033     const std::string& name, const Logging::Level& lvl = Logging::INFO,
0034     std::ostream* log_stream = &std::cout);
0035 
0036 /// Construct a dummy logger that does nothing
0037 ///
0038 /// @return a reference to the dummy logger
0039 ///
0040 const Logger& getDummyLogger();
0041 
0042 }  // namespace traccc
0043 
0044 #define TRACCC_LOCAL_LOGGER(x) ACTS_LOCAL_LOGGER(x)
0045 #define TRACCC_LOG(level, x) ACTS_LOG(level, log)
0046 #define TRACCC_VERBOSE(x) ACTS_VERBOSE(x)
0047 #define TRACCC_DEBUG(x) ACTS_DEBUG(x)
0048 #define TRACCC_INFO(x) ACTS_INFO(x)
0049 #define TRACCC_WARNING(x) ACTS_WARNING(x)
0050 #define TRACCC_ERROR(x) ACTS_ERROR(x)
0051 #define TRACCC_FATAL(x) ACTS_FATAL(x)
0052 
0053 // Define traccc logging macros that are safe to use in device compiled code:
0054 
0055 // Printed only when compiled for host
0056 // TODO: Harmonize with ACTS logger
0057 #define TRACCC_FATAL_HOST(x) DETRAY_FATAL_STREAM("TRACCC", x)
0058 #define TRACCC_ERROR_HOST(x) DETRAY_ERROR_STREAM("TRACCC", x)
0059 #define TRACCC_WARNING_HOST(x) DETRAY_WARN_STREAM("TRACCC", x)
0060 #define TRACCC_INFO_HOST(x) DETRAY_INFO_STREAM("TRACCC", x)
0061 #define TRACCC_VERBOSE_HOST(x) DETRAY_VERBOSE_STREAM("TRACCC", x)
0062 #define TRACCC_DEBUG_HOST(x) DETRAY_DEBUG_STREAM("TRACCC", x)
0063 
0064 // Printed in both host and device execution
0065 // TODO: Implement rate limiting
0066 #define TRACCC_FATAL_HOST_DEVICE(x, ...) \
0067   DETRAY_FATAL_PRINTF("TRACCC", x, __VA_ARGS__)
0068 #define TRACCC_ERROR_HOST_DEVICE(x, ...) \
0069   DETRAY_ERROR_PRINTF("TRACCC", x, __VA_ARGS__)
0070 #define TRACCC_WARNING_HOST_DEVICE(x, ...) \
0071   DETRAY_WARN_PRINTF("TRACCC", x, __VA_ARGS__)
0072 #define TRACCC_INFO_HOST_DEVICE(x, ...) \
0073   DETRAY_INFO_PRINTF("TRACCC", x, __VA_ARGS__)
0074 #define TRACCC_VERBOSE_HOST_DEVICE(x, ...) \
0075   DETRAY_VERBOSE_PRINTF("TRACCC", x, __VA_ARGS__)
0076 #define TRACCC_DEBUG_HOST_DEVICE(x, ...) \
0077   DETRAY_DEBUG_PRINTF("TRACCC", x, __VA_ARGS__)
0078 
0079 // Printed only when compiled for device
0080 #ifdef __DEVICE_LOGGING__
0081 
0082 #define TRACCC_FATAL_DEVICE(x, ...) \
0083   DETRAY_FATAL_PRINTF("TRACCC", x, __VA_ARGS__)
0084 #define TRACCC_ERROR_DEVICE(x, ...) \
0085   DETRAY_ERROR_PRINTF("TRACCC", x, __VA_ARGS__)
0086 #define TRACCC_WARNING_DEVICE(x, ...) \
0087   DETRAY_WARN_PRINTF("TRACCC", x, __VA_ARGS__)
0088 #define TRACCC_INFO_DEVICE(x, ...) DETRAY_INFO_PRINTF("TRACCC", x, __VA_ARGS__)
0089 #define TRACCC_VERBOSE_DEVICE(x, ...) \
0090   DETRAY_VERBOSE_PRINTF("TRACCC", x, __VA_ARGS__)
0091 #define TRACCC_DEBUG_DEVICE(x, ...) \
0092   DETRAY_DEBUG_PRINTF("TRACCC", x, __VA_ARGS__)
0093 
0094 #else
0095 
0096 #define TRACCC_FATAL_DEVICE(x, ...)
0097 #define TRACCC_ERROR_DEVICE(x, ...)
0098 #define TRACCC_WARNING_DEVICE(x, ...)
0099 #define TRACCC_INFO_DEVICE(x, ...)
0100 #define TRACCC_VERBOSE_DEVICE(x, ...)
0101 #define TRACCC_DEBUG_DEVICE(x, ...)
0102 
0103 #endif