GEOS
LogLevelsInfo.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_COMMON_LOGLEVELSINFO_HPP
21 #define GEOS_COMMON_LOGLEVELSINFO_HPP
22 
23 #include "common/DataTypes.hpp"
24 #include "common/format/Format.hpp"
25 
26 namespace geos
27 {
28 
40 template< typename LOG_LEVEL_INFO >
41 static constexpr bool is_log_level_info =
42  std::is_same_v< integer, decltype(LOG_LEVEL_INFO::getMinLogLevel()) > &&
43  std::is_same_v< std::string_view, decltype(LOG_LEVEL_INFO::getDescription()) >;
44 
53 template< typename LOG_LEVEL_INFO >
54 std::enable_if_t< is_log_level_info< LOG_LEVEL_INFO >, bool >
56 {
57  return level >= LOG_LEVEL_INFO::getMinLogLevel();
58 }
59 
66 #define GEOS_LOG_LEVEL_INFO( logInfoStruct, msg ) GEOS_LOG_IF( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
67 
73 #define GEOS_LOG_LEVEL_INFO_RANK_0( logInfoStruct, msg ) GEOS_LOG_RANK_0_IF( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
74 
80 #define GEOS_LOG_LEVEL_INFO_BY_RANK( logInfoStruct, msg ) GEOS_LOG_RANK_IF( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
81 
87 #define GEOS_LOG_LEVEL_INFO_RANK_0_NLR( logInfoStruct, msg ) GEOS_LOG_RANK_0_IF_NLR( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
88 
89 }
90 
91 #endif // GEOS_COMMON_LOGLEVELSINFO_HPP
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
std::enable_if_t< is_log_level_info< LOG_LEVEL_INFO >, bool > isLogLevelActive(integer level)
Verify if a log level is active.
static constexpr bool is_log_level_info
Trait used to check whether a LOG_LEVEL_INFO structure is valid.
std::string_view string_view
String type.
Definition: DataTypes.hpp:94