Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log to stderr in valhalla_export_edges #4498

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
* FIXED: base transition costs were getting overridden by osrm car turn duration [#4463](https://github.com/valhalla/valhalla/pull/4463)
* FIXED: insane ETAs for `motor_scooter` on `track`s [#4468](https://github.com/valhalla/valhalla/pull/4468)
* FIXED: -j wasn't taken into account anymore [#4483](https://github.com/valhalla/valhalla/pull/4483)
* FIXED: time distance matrix was always using time zone of last settled edge id []()
* FIXED: time distance matrix was always using time zone of last settled edge id [#4494](https://github.com/valhalla/valhalla/pull/4494)
* FIXED: log to stderr in valhalla_export_edges [#4498](https://github.com/valhalla/valhalla/pull/4498)
* **Enhancement**
* UPDATED: French translations, thanks to @xlqian [#4159](https://github.com/valhalla/valhalla/pull/4159)
* CHANGED: -j flag for multithreaded executables to override mjolnir.concurrency [#4168](https://github.com/valhalla/valhalla/pull/4168)
Expand Down
4 changes: 2 additions & 2 deletions src/argparse_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @param opts The command line options
* @param result The parsed result
* @param config The config which will be populated here
* @param log The logging config node's key
* @param log The logging config node's key. If empty, logging will not be configured.
* @param use_threads Whether this program multi-threads
*
* @returns true if the program should continue, false if we should EXIT_SUCCESS
Expand Down Expand Up @@ -51,7 +51,7 @@ bool parse_common_args(const std::string& program,

// configure logging
auto logging_subtree = conf.get_child_optional(log);
if (logging_subtree) {
if (!log.empty() && logging_subtree) {
auto logging_config =
valhalla::midgard::ToMap<const boost::property_tree::ptree&,
std::unordered_map<std::string, std::string>>(logging_subtree.get());
Expand Down
5 changes: 4 additions & 1 deletion src/valhalla_export_edges.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
// clang-format on

auto result = options.parse(argc, argv);
if (!parse_common_args(program, options, result, config, "mjolnir.logging"))
if (!parse_common_args(program, options, result, config, ""))

Check warning on line 170 in src/valhalla_export_edges.cc

View check run for this annotation

Codecov / codecov/patch

src/valhalla_export_edges.cc#L170

Added line #L170 was not covered by tests
return EXIT_SUCCESS;
} catch (cxxopts::OptionException& e) {
std::cerr << e.what() << std::endl;
Expand All @@ -181,6 +181,9 @@
// get something we can use to fetch tiles
valhalla::baldr::GraphReader reader(config.get_child("mjolnir"));

// configure logging here, we want it to go to stderr
valhalla::midgard::logging::Configure({{"type", "std_err"}, {"color", "true"}});

Check warning on line 185 in src/valhalla_export_edges.cc

View check run for this annotation

Codecov / codecov/patch

src/valhalla_export_edges.cc#L185

Added line #L185 was not covered by tests

// keep the global number of edges encountered at the point we encounter each tile
// this allows an edge to have a sequential global id and makes storing it very small
LOG_INFO("Enumerating edges...");
Expand Down
Loading