Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
b
c
d
e
h
i
l
m
n
p
r
s
u
x
Typedefs
b
c
d
e
f
g
i
m
p
r
u
v
Enumerations
Enumerator
a
b
f
g
i
m
n
r
s
u
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
m
n
p
q
r
s
t
u
v
x
Enumerations
a
c
d
e
f
k
l
m
p
r
s
t
v
w
Enumerator
a
b
d
f
g
h
i
l
m
n
o
p
r
s
u
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
b
c
d
e
f
g
m
o
p
r
s
t
u
v
w
Variables
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
w
Typedefs
Enumerations
Enumerator
Macros
_
d
f
i
m
n
p
s
t
u
examples
host_side
device_logging.cpp
Go to the documentation of this file.
1
#include <fstream>
2
#include <iostream>
3
4
// Includes common necessary includes for development using depthai library
5
#include "
depthai/depthai.hpp
"
6
7
int
main
() {
8
using namespace
std
;
9
using namespace
std::chrono_literals;
10
11
// Create a log file
12
ofstream logstream{
"device.log"
};
13
14
// Connect to device and start pipeline
15
dai::Device::Config
config;
16
config.
logLevel
=
dai::LogLevel::DEBUG
;
17
config.
outputLogLevel
=
dai::LogLevel::WARN
;
18
config.
board
.
logDevicePrints
=
true
;
19
dai::Device
device(config,
dai::UsbSpeed::SUPER
);
20
21
// Configure logging
22
device.
addLogCallback
([&logstream](
dai::LogMessage
msg) {
23
logstream <<
"["
<< msg.
nodeIdName
<<
"] "
<< msg.
payload
<< endl;
24
cout <<
"[LOGGED] ["
<< msg.
nodeIdName
<<
"] "
<< msg.
payload
<< endl;
25
});
26
27
// Print available sensors
28
cout <<
"Available camera sensors: "
;
29
for
(
auto
& sensor : device.
getCameraSensorNames
()) {
30
cout <<
"Socket: "
<< sensor.first <<
" - "
<< sensor.second <<
", "
;
31
}
32
cout << endl;
33
34
// Print device name
35
cout <<
"Device name: "
<< device.
getDeviceName
() << endl;
36
37
// Wait a tad for some logs to arrive
38
this_thread::sleep_for(3s);
39
40
return
0;
41
}
dai::LogMessage::nodeIdName
std::string nodeIdName
Definition:
LogMessage.hpp:14
dai::DeviceBase::Config::board
BoardConfig board
Definition:
DeviceBase.hpp:74
dai::UsbSpeed::SUPER
@ SUPER
dai::LogMessage::payload
std::string payload
Definition:
LogMessage.hpp:19
depthai.hpp
dai::DeviceBase::Config::logLevel
tl::optional< LogLevel > logLevel
Definition:
DeviceBase.hpp:77
dai::DeviceBase::getDeviceName
std::string getDeviceName()
Definition:
DeviceBase.cpp:1226
dai::LogMessage
Definition:
LogMessage.hpp:13
dai::LogLevel::WARN
@ WARN
dai::DeviceBase::getCameraSensorNames
std::unordered_map< CameraBoardSocket, std::string > getCameraSensorNames()
Definition:
DeviceBase.cpp:1117
main
int main()
Definition:
device_logging.cpp:7
dai::Device
Definition:
Device.hpp:21
dai::DeviceBase::Config::outputLogLevel
tl::optional< LogLevel > outputLogLevel
Definition:
DeviceBase.hpp:76
std
Definition:
Node.hpp:366
dai::DeviceBase::Config
Definition:
DeviceBase.hpp:72
dai::DeviceBase::addLogCallback
int addLogCallback(std::function< void(LogMessage)> callback)
Definition:
DeviceBase.cpp:1272
dai::LogLevel::DEBUG
@ DEBUG
dai::BoardConfig::logDevicePrints
tl::optional< bool > logDevicePrints
log device prints
Definition:
BoardConfig.hpp:111
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19