use new logging flags
This commit is contained in:
@@ -221,7 +221,7 @@ void LoadAndSolve(const std::string& file_name, int instance) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
|
||||
@@ -56,7 +56,7 @@ void RunConstraintProgrammingExample() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
operations_research::RunConstraintProgrammingExample();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ void CostasBoolSoft(const int dim) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
int min = 1;
|
||||
|
||||
@@ -120,7 +120,7 @@ void GolombRuler(int size) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
if (absl::GetFlag(FLAGS_size) != 0) {
|
||||
|
||||
@@ -849,7 +849,7 @@ void Solve(const JsspInputProblem& problem) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
|
||||
@@ -225,7 +225,7 @@ void LoadAndSolve(const std::string& file_name, int instance) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
|
||||
@@ -92,7 +92,7 @@ void MagicSequence(int size) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
operations_research::sat::MagicSequence(absl::GetFlag(FLAGS_size));
|
||||
|
||||
@@ -101,7 +101,7 @@ void MagicSquare(int size) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
operations_research::sat::MagicSquare(absl::GetFlag(FLAGS_size));
|
||||
|
||||
@@ -54,7 +54,7 @@ void SolveMaxFlow() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
operations_research::SolveMaxFlow();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void SolveMinCostFlow() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
operations_research::SolveMinCostFlow();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int main(int argc, char* argv[]) {
|
||||
"The files must be in Mps or linear_solver.proto format and can be "
|
||||
"compressed with gzip.",
|
||||
&argc, &argv, true);
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
|
||||
GlopParameters parameters;
|
||||
ReadGlopParameters(¶meters);
|
||||
|
||||
@@ -109,7 +109,7 @@ void MultiKnapsackSat(int scaling, const std::string& params) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
operations_research::sat::MultiKnapsackSat(absl::GetFlag(FLAGS_size),
|
||||
absl::GetFlag(FLAGS_params));
|
||||
|
||||
@@ -678,7 +678,7 @@ class NetworkRoutingSolver {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
operations_research::sat::NetworkRoutingData data;
|
||||
|
||||
@@ -124,7 +124,7 @@ void Solve(const std::string& input, const std::string& params_str,
|
||||
} // namespace operations_research::pdlp
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
google::InitGoogleLogging(kUsageStr);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ bool LoadAndSolve(const std::string& pdp_file,
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
operations_research::RoutingModelParameters model_parameters =
|
||||
operations_research::DefaultRoutingModelParameters();
|
||||
|
||||
@@ -304,7 +304,7 @@ void LoadAndSolve(const std::string& file_name) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
|
||||
@@ -327,7 +327,7 @@ static const char kUsage[] =
|
||||
"There is no output besides the LOGs of the solver.";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(kUsage, &argc, &argv, true);
|
||||
CHECK_EQ(0, absl::GetFlag(FLAGS_num_teams) % 2)
|
||||
<< "The number of teams must be even";
|
||||
|
||||
@@ -237,7 +237,7 @@ int main(int argc, char** argv) {
|
||||
<< "Specify a non-null client size.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_fix_cost))
|
||||
<< "Specify a non-null client size.";
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
operations_research::RunAllExamples(absl::GetFlag(FLAGS_facilities),
|
||||
absl::GetFlag(FLAGS_clients),
|
||||
absl::GetFlag(FLAGS_fix_cost));
|
||||
|
||||
@@ -98,7 +98,7 @@ void ParseAndSolve(const std::string& filename, absl::string_view solver,
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
|
||||
@@ -252,7 +252,7 @@ void ParseAndSolve() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
|
||||
@@ -119,7 +119,7 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
pywrapinit.CppBridge.InitLogging('integer_programming.py')
|
||||
cpp_flags = pywrapinit.CppFlags()
|
||||
cpp_flags.logtostderr = True
|
||||
cpp_flags.stderrthreshold = 0
|
||||
cpp_flags.log_prefix = False
|
||||
pywrapinit.CppBridge.SetFlags(cpp_flags)
|
||||
main()
|
||||
|
||||
@@ -226,7 +226,7 @@ void RunAllExamples() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||
operations_research::RunAllExamples();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
// Compatibility layer for glog/previous logging code.
|
||||
ABSL_DECLARE_FLAG(bool, logtostderr);
|
||||
|
||||
// Forward the new flag.
|
||||
ABSL_DECLARE_FLAG(int, stderrthreshold);
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
void FixFlagsAndEnvironmentForSwig();
|
||||
|
||||
Reference in New Issue
Block a user