blob: 03842be02d0efcfa5e60a3091bc9fa40f64ad286 (
plain)
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
41
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* log.h - Logging infrastructure
*/
#ifndef __LIBCAMERA_LOG_H__
#define __LIBCAMERA_LOG_H__
#include <sstream>
namespace libcamera {
enum LogSeverity {
LogDebug,
LogInfo,
LogWarning,
LogError,
LogFatal,
};
class LogMessage
{
public:
LogMessage(const char *fileName, unsigned int line,
LogSeverity severity);
LogMessage(const LogMessage&) = delete;
~LogMessage();
std::ostream& stream() { return msgStream; }
private:
std::ostringstream msgStream;
LogSeverity severity_;
};
#define LOG(severity) LogMessage(__FILE__, __LINE__, Log##severity).stream()
} /* namespace libcamera */
#endif /* __LIBCAMERA_LOG_H__ */
|