YARP
Yet Another Robot Platform
Loading...
Searching...
No Matches
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
6
#include <
yarp/serversql/impl/LogComponent.h
>
7
8
#include <
yarp/os/Os.h
>
9
10
#include <atomic>
11
#include <cstring>
12
namespace
{
13
std::atomic<yarp::os::Log::LogType> minimumServersqlPrintLevel(
yarp::os::Log::InfoType
);
14
}
// namespace
15
16
void
yarp::serversql::impl::LogComponent::print_callback
(
yarp::os::Log::LogType
type,
17
const
char
* msg,
18
const
char
* file,
19
const
unsigned
int
line,
20
const
char
* func,
21
double
systemtime,
22
double
networktime,
23
double
externaltime,
24
const
char
* comp_name,
25
const
char
*
id
)
26
{
27
auto
minlev = minimumServersqlPrintLevel.load();
28
if
(type >= minlev) {
29
if
(minlev <=
yarp::os::Log::DebugType
) {
30
yarp::os::Log::printCallback
()(type, msg, file, line, func, systemtime, networktime, externaltime, comp_name, id);
31
}
else
{
32
static
const
char
* err_str =
"[ERROR] "
;
33
static
const
char
* warn_str =
"[WARNING] "
;
34
static
const
char
* no_str =
""
;
35
printf(
"%s%s\n"
,
36
((type ==
yarp::os::Log::ErrorType
) ? err_str : ((type ==
yarp::os::Log::WarningType
) ? warn_str : no_str)),
37
msg);
38
}
39
}
40
}
41
42
void
yarp::serversql::impl::LogComponent::setMinumumLogType
(
yarp::os::Log::LogType
minumumLogType)
43
{
44
minimumServersqlPrintLevel = minumumLogType;
45
}
Os.h
yarp::os::Log::printCallback
static LogCallback printCallback()
Get current print callback.
Definition
Log.cpp:873
yarp::os::Log::LogType
LogType
Definition
Log.h:90
yarp::os::Log::ErrorType
@ ErrorType
Definition
Log.h:96
yarp::os::Log::DebugType
@ DebugType
Definition
Log.h:93
yarp::os::Log::InfoType
@ InfoType
Definition
Log.h:94
yarp::os::Log::WarningType
@ WarningType
Definition
Log.h:95
LogComponent.h
yarp::serversql::impl::LogComponent::setMinumumLogType
void setMinumumLogType(yarp::os::Log::LogType minumumLogType)
Definition
LogComponent.cpp:42
yarp::serversql::impl::LogComponent::print_callback
void print_callback(yarp::os::Log::LogType type, const char *msg, const char *file, const unsigned int line, const char *func, double systemtime, double networktime, double externaltime, const char *comp_name, const char *id)
Definition
LogComponent.cpp:16
YARP
3.11.100+20250401.4+gitb9213d601
src
libYARP_serversql
src
yarp
serversql
impl
LogComponent.cpp
Generated on Fri May 9 2025 02:40:48 for YARP by
1.9.8