Skip to content

Commit

Permalink
Per #2609, refine the logic here a bit. Save the print_warning state …
Browse files Browse the repository at this point in the history
…of the logger and reset it back to that state when done reading data. Get rid of the search_all_files flag since it'll always be true, even in tc_diag's use of it.
  • Loading branch information
JohnHalleyGotway committed Jul 26, 2023
1 parent 95724db commit 684561d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/basic/vx_log/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,17 @@ void Logger::dump(ostream & dump_out, int depth) const
//////////////////////////////////////////////////////////////////


bool Logger::print_warning() const
{

return (Warning.PrintWarning);

}


//////////////////////////////////////////////////////////////////


void Logger::set_verbosity_level(const int i)
{
//
Expand Down
2 changes: 2 additions & 0 deletions src/basic/vx_log/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ class Logger

int verbosity_level() const;

bool print_warning() const;

bool is_open() const;

//
Expand Down
16 changes: 9 additions & 7 deletions src/libcode/vx_series_data/series_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ static bool read_single_entry(VarInfo*, const ConcatString&, const GrdFileType,
bool get_series_entry(int i_series, VarInfo* data_info,
const StringArray& search_files, const GrdFileType type,
DataPlane& dp, Grid& grid,
bool error_out, bool print_warning,
bool search_all_files) {
bool error_out, bool print_warning) {
int i;
bool found;

// Suppress warnings, if requested
// Save the log print warning state
bool save_print_warning_state = mlog.print_warning();

// Suppress log warnings, if requested
if(!print_warning) mlog.set_print_warning(false);

mlog << Debug(3)
Expand All @@ -51,8 +53,8 @@ bool get_series_entry(int i_series, VarInfo* data_info,
found = read_single_entry(data_info, search_files[i_cur],
type, dp, grid);

// Break out of the loop if data was found or not searching all files
if(found || !search_all_files) break;
// Break out of the loop if data was found
if(found) break;

} // end for i

Expand All @@ -64,8 +66,8 @@ bool get_series_entry(int i_series, VarInfo* data_info,
exit(1);
}

// Restore warnings, if requested
if(!print_warning) mlog.set_print_warning(true);
// Restore warnings to their original state
mlog.set_print_warning(save_print_warning_state);

return(found);
}
Expand Down
3 changes: 1 addition & 2 deletions src/libcode/vx_series_data/series_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
bool get_series_entry(int, VarInfo*, const StringArray&,
const GrdFileType, DataPlane&, Grid&,
bool error_out=true,
bool print_warning=true,
bool search_all_files=true);
bool print_warning=true);

////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion src/tools/tc_utils/tc_diag/tc_diag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ void process_fields(const TrackInfoArray &tracks,
bool status = get_series_entry(i_vld, vi,
di.data_files, file_type,
data_dp, grid_dp,
false, false, false);
false, false);

// Keep track of missing fields
if(!status) {
Expand Down

0 comments on commit 684561d

Please sign in to comment.