YARP
Yet Another Robot Platform
LogComponent.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
7 
9 
10 #include <atomic>
11 #include <cstring>
12 #include <cstdlib>
13 
14 namespace {
15 
16 std::atomic<bool> quiet(yarp::conf::environment::get_bool("YARP_QUIET", false));
17 std::atomic<bool> verbose(yarp::conf::environment::get_bool("YARP_VERBOSE", false) && !quiet.load());
18 
19 std::atomic<yarp::os::Log::LogType> minimumOsPrintLevel(
20  (quiet.load() ? yarp::os::Log::WarningType :
22 
23 } // namespace
24 
26 {
27  return minimumOsPrintLevel.load();
28 }
29 
31 {
32  minimumOsPrintLevel = minumumLogType;
33 }
@ DebugType
Definition: Log.h:75
@ InfoType
Definition: Log.h:76
@ WarningType
Definition: Log.h:77
bool get_bool(const std::string &key, bool defaultValue=false)
Read a bool value from an environment variable.
Definition: environment.h:174
yarp::os::Log::LogType minimumLogType()
void setMinumumLogType(yarp::os::Log::LogType minumumLogType)