OR-Tools  9.6
vlog.h
Go to the documentation of this file.
1 // Copyright 2010-2022 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #ifndef OR_TOOLS_BASE_VLOG_H_
15 #define OR_TOOLS_BASE_VLOG_H_
16 
17 #include <errno.h>
18 #include <string.h>
19 #include <time.h>
20 
21 #include <cassert>
22 #include <cstddef>
23 #include <iosfwd>
24 #include <ostream>
25 #include <sstream>
26 #include <string>
27 #if defined(__GNUC__) && defined(__linux__)
28 #include <unistd.h>
29 #endif
30 #include <vector>
31 
32 #include "absl/flags/flag.h"
33 #include "absl/log/check.h"
36 
37 // Log only in verbose mode.
38 
39 #define VLOG(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel))
40 
41 #define VLOG_EVERY_N(verboselevel, n) \
42  LOG_IF_EVERY_N(INFO, VLOG_IS_ON(verboselevel), n)
43 
44 #if defined(DEBUG_MODE)
45 #define DVLOG(verboselevel) VLOG(verboselevel)
46 #else // !defined(DEBUG_MODE)
47 #define DVLOG(verboselevel) LOG_IF(INFO, false)
48 #endif // !defined(DEBUG_MODE)
49 
50 #endif // OR_TOOLS_BASE_VLOG_H_