-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathlogging.cpp
More file actions
40 lines (33 loc) · 1.05 KB
/
logging.cpp
File metadata and controls
40 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include "logging.h"
extern "C" {
int libcamera_log_set_file(const char *path, bool color) {
return libcamera::logSetFile(path, color);
}
int libcamera_log_set_stream(libcamera_logging_stream_t stream, bool color) {
std::ostream *ostream = nullptr;
switch (stream) {
case LIBCAMERA_LOGGING_STREAM_STDOUT:
ostream = &std::cout;
break;
case LIBCAMERA_LOGGING_STREAM_STDERR:
ostream = &std::cerr;
break;
case LIBCAMERA_LOGGING_STREAM_CUSTOM:
return -EINVAL;
}
return libcamera::logSetStream(ostream, color);
}
int libcamera_log_set_custom_stream(void *ostream, bool color) {
if (!ostream)
return -EINVAL;
auto *os = static_cast<std::ostream *>(ostream);
return libcamera::logSetStream(os, color);
}
int libcamera_log_set_target(libcamera_logging_target_t target) {
return libcamera::logSetTarget(target);
}
void libcamera_log_set_level(const char *category, const char *level) {
libcamera::logSetLevel(category, level);
}
}