OR-Tools  9.6
base/logging.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_LOGGING_H_
15 #define OR_TOOLS_BASE_LOGGING_H_
16 
17 #define ABSL_LOG_INTERNAL_CONDITION_DFATAL ABSL_LOG_INTERNAL_CONDITION_ERROR
18 #define kLogDebugFatal LogSeverity::kError
19 #define kDebugFatal kError
20 
21 #include "absl/base/log_severity.h"
22 #include "absl/flags/declare.h"
23 #include "absl/log/die_if_null.h"
24 #include "absl/log/log.h"
25 #include "absl/memory/memory.h"
26 #include "absl/status/status.h"
27 #include "absl/strings/str_cat.h"
28 #include "absl/strings/string_view.h"
29 #include "google/protobuf/message.h"
30 #include "ortools/base/macros.h"
31 #include "ortools/base/vlog.h"
32 
33 // Compatibility layer for glog/previous logging code.
34 ABSL_DECLARE_FLAG(bool, logtostderr);
35 
36 // Forward the new flag.
37 ABSL_DECLARE_FLAG(int, stderrthreshold);
38 
39 namespace operations_research {
40 
42 
43 } // namespace operations_research
44 
45 // Compatibility layer for SCIP
46 namespace google {
48  GLOG_INFO = static_cast<int>(absl::LogSeverity::kInfo),
49  GLOG_WARNING = static_cast<int>(absl::LogSeverity::kWarning),
50  GLOG_ERROR = static_cast<int>(absl::LogSeverity::kError),
51  GLOG_FATAL = static_cast<int>(absl::LogSeverity::kFatal),
52 };
53 } // namespace google
54 
55 // Implementation of the `AbslStringify` interface. This adds `DebugString()`
56 // to the sink. Do not rely on exact format.
57 namespace google {
58 namespace protobuf {
59 template <typename Sink>
60 void AbslStringify(Sink& sink, const Message& msg) {
61  sink.Append(msg.DebugString());
62 }
63 } // namespace protobuf
64 } // namespace google
65 
66 #endif // OR_TOOLS_BASE_LOGGING_H_
ABSL_DECLARE_FLAG(bool, logtostderr)
void AbslStringify(Sink &sink, const Message &msg)
Definition: base/logging.h:60
@ GLOG_FATAL
Definition: base/logging.h:51
@ GLOG_ERROR
Definition: base/logging.h:50
@ GLOG_INFO
Definition: base/logging.h:48
@ GLOG_WARNING
Definition: base/logging.h:49
Collection of objects used to extend the Constraint Solver library.
void FixFlagsAndEnvironmentForSwig()
Definition: base/logging.cc:31