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