Blender V4.5
log.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#if defined(WITH_CYCLES_LOGGING) && !defined(__KERNEL_GPU__)
8# include <gflags/gflags.h> // IWYU pragma: export
9# include <glog/logging.h> // IWYU pragma: export
10#endif
11
12#include <iosfwd>
13
15
16#if !defined(WITH_CYCLES_LOGGING) || defined(__KERNEL_GPU__)
18 public:
19 template<class T> StubStream &operator<<(const T &)
20 {
21 return *this;
22 }
23};
24
26 public:
28 void operator&(const StubStream &) {}
29};
30
31# define LOG_SUPPRESS() (true) ? ((void)0) : LogMessageVoidify() & StubStream()
32# define LOG(severity) LOG_SUPPRESS()
33# define VLOG(severity) LOG_SUPPRESS()
34# define VLOG_IF(severity, condition) LOG_SUPPRESS()
35# define VLOG_IS_ON(severity) false
36
37# define CHECK(expression) LOG_SUPPRESS()
38
39# define CHECK_NOTNULL(expression) (expression)
40
41# define CHECK_NEAR(actual, expected, eps) LOG_SUPPRESS()
42
43# define CHECK_GE(a, b) LOG_SUPPRESS()
44# define CHECK_NE(a, b) LOG_SUPPRESS()
45# define CHECK_EQ(a, b) LOG_SUPPRESS()
46# define CHECK_GT(a, b) LOG_SUPPRESS()
47# define CHECK_LT(a, b) LOG_SUPPRESS()
48# define CHECK_LE(a, b) LOG_SUPPRESS()
49
50# define DCHECK(expression) LOG_SUPPRESS()
51
52# define DCHECK_NOTNULL(expression) (expression)
53
54# define DCHECK_NEAR(actual, expected, eps) LOG_SUPPRESS()
55
56# define DCHECK_GE(a, b) LOG_SUPPRESS()
57# define DCHECK_NE(a, b) LOG_SUPPRESS()
58# define DCHECK_EQ(a, b) LOG_SUPPRESS()
59# define DCHECK_GT(a, b) LOG_SUPPRESS()
60# define DCHECK_LT(a, b) LOG_SUPPRESS()
61# define DCHECK_LE(a, b) LOG_SUPPRESS()
62
63# define LOG_ASSERT(expression) LOG_SUPPRESS()
64#endif
65
66/* Verbose logging categories. */
67
68/* Warnings. */
69#define VLOG_WARNING VLOG(1)
70/* Info about devices, scene contents and features used. */
71#define VLOG_INFO VLOG(2)
72#define VLOG_INFO_IS_ON VLOG_IS_ON(2)
73/* Work being performed and timing/memory stats about that work. */
74#define VLOG_WORK VLOG(3)
75#define VLOG_WORK_IS_ON VLOG_IS_ON(3)
76/* Detailed device timing stats. */
77#define VLOG_DEVICE_STATS VLOG(4)
78#define VLOG_DEVICE_STATS_IS_ON VLOG_IS_ON(4)
79/* Verbose debug messages. */
80#define VLOG_DEBUG VLOG(5)
81#define VLOG_DEBUG_IS_ON VLOG_IS_ON(5)
82
83struct int2;
84struct float3;
85
86void util_logging_init(const char *argv0);
88void util_logging_verbosity_set(const int verbosity);
89
90std::ostream &operator<<(std::ostream &os, const int2 &value);
91std::ostream &operator<<(std::ostream &os, const float3 &value);
92
void operator&(const StubStream &)
Definition log.h:28
LogMessageVoidify()
Definition log.h:27
StubStream & operator<<(const T &)
Definition log.h:19
#define CCL_NAMESPACE_END
void util_logging_init(const char *argv0)
Definition log.cpp:30
void util_logging_verbosity_set(const int verbosity)
Definition log.cpp:60
std::ostream & operator<<(std::ostream &os, const int2 &value)
Definition log.cpp:72
void util_logging_start()
Definition log.cpp:47
#define T