GEOS
LogLevelsInfo.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_COMMON_LOGLEVELSINFO_HPP
20 #define GEOS_COMMON_LOGLEVELSINFO_HPP
21 
22 #include "common/DataTypes.hpp"
23 #include "common/format/Format.hpp"
24 
25 namespace geos
26 {
27 
39 template< typename LOG_LEVEL_INFO >
40 static constexpr bool is_log_level_info =
41  std::is_same_v< integer, decltype(LOG_LEVEL_INFO::getMinLogLevel()) > &&
42  std::is_same_v< std::string_view, decltype(LOG_LEVEL_INFO::getDescription()) >;
43 
52 template< typename LOG_LEVEL_INFO >
53 std::enable_if_t< is_log_level_info< LOG_LEVEL_INFO >, bool >
55 {
56  return level >= LOG_LEVEL_INFO::getMinLogLevel();
57 }
58 
65 #define GEOS_LOG_LEVEL_INFO( logInfoStruct, msg ) GEOS_LOG_IF( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
66 
72 #define GEOS_LOG_LEVEL_INFO_RANK_0( logInfoStruct, msg ) GEOS_LOG_RANK_0_IF( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
73 
79 #define GEOS_LOG_LEVEL_INFO_BY_RANK( logInfoStruct, msg ) GEOS_LOG_RANK_IF( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
80 
86 #define GEOS_LOG_LEVEL_INFO_RANK_0_NLR( logInfoStruct, msg ) GEOS_LOG_RANK_0_IF_NLR( isLogLevelActive< logInfoStruct >( this->getLogLevel() ), msg );
87 
88 }
89 
90 #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