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