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
14namespace {
15
16std::atomic<bool> quiet(yarp::conf::environment::get_bool("YARP_QUIET", false));
17std::atomic<bool> verbose(yarp::conf::environment::get_bool("YARP_VERBOSE", false) && !quiet.load());
18
19std::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:92
@ InfoType
Definition: Log.h:93
@ WarningType
Definition: Log.h:94
bool get_bool(const std::string &key, bool defaultValue=false)
Read a bool value from an environment variable.
Definition: environment.h:172
yarp::os::Log::LogType minimumLogType()
void setMinumumLogType(yarp::os::Log::LogType minumumLogType)