From: jfa Date: Wed, 19 Jul 2023 14:13:09 +0000 (+0100) Subject: Merge branch 'V9_11_BR' X-Git-Tag: emc2p_1.4.0-rc1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e196d7e6dbb65ed976b18fcc776d6f85a3ae3dfc;p=modules%2Fkernel.git Merge branch 'V9_11_BR' --- e196d7e6dbb65ed976b18fcc776d6f85a3ae3dfc diff --cc bin/appliskel/salome_common.py index cb9393113,9b9b25b77..51cecf85f --- a/bin/appliskel/salome_common.py +++ b/bin/appliskel/salome_common.py @@@ -1,5 -1,5 +1,5 @@@ - #! /usr/bin/env python3 +#! /usr/bin/env python3 - # Copyright (C) 2021-2022 CEA/DEN, EDF R&D + # Copyright (C) 2021-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --cc src/Basics/libSALOMELog.cxx index cfaaeada5,000000000..fe0beeb2a mode 100644,000000..100644 --- a/src/Basics/libSALOMELog.cxx +++ b/src/Basics/libSALOMELog.cxx @@@ -1,69 -1,0 +1,69 @@@ - // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE ++// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// Author : Konstantin Leontev (OpenCascade) +// Module : KERNEL +// $Header$ +// + +#include "libSALOMELog.hxx" + +#include +#include + +namespace SALOME +{ + +// ============================================================================ +/*! + * Called by any log message macros to decide about log output in Release and + * Debug mode dynamically rely on SALOME_VERBOSE environment variable. + * Checks SALOME_VERBOSE only on the very first call and returns cached result + * for all followed calls. + * Returns true if SALOME_VERBOSE is positioned and not empty and if its + * numeric value greater than 0. + */ +// ============================================================================ + + bool VerbosityActivated() + { + auto isEnvVarSet = []() -> bool + { + const char* envVar = std::getenv("SALOME_VERBOSE"); + + if (envVar && (envVar[0] != '\0')) + { + try + { + const long long numValue = std::stoll(envVar); + return numValue > 0; + } + catch(const std::exception& e) + { + std::cerr << e.what() << '\n'; + } + } + + return false; + }; + + static const bool isActivated = isEnvVarSet(); + return isActivated; + } +} diff --cc src/Basics/libSALOMELog.hxx index 1a53ec133,000000000..93949515b mode 100644,000000..100644 --- a/src/Basics/libSALOMELog.hxx +++ b/src/Basics/libSALOMELog.hxx @@@ -1,32 -1,0 +1,32 @@@ - // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE ++// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : libSALOMELog.hxx +// Author : Konstantin Leontev (OpenCascade) +// Module : KERNEL +// $Header$ +// +#pragma once + +#include "SALOME_Basics.hxx" + +namespace SALOME +{ + bool BASICS_EXPORT VerbosityActivated(); +}