diff --git a/src/cats/actions/cats_actions.c b/src/cats/actions/cats_actions.c index 2210b6fb7747b71f2cc3231ac67066250afae06c..62546411acfff774447685d365ab056c46062063 100644 --- a/src/cats/actions/cats_actions.c +++ b/src/cats/actions/cats_actions.c @@ -64,7 +64,9 @@ void run_simulation_phase(struct cats_grid **grid, struct cats_configuration *co for (int action = 0; action < conf->cycle.num_actions; action++) { - if (!(conf->cycle.actions[action].stages & stage)) continue; + if (!(conf->cycle.actions[action].stages & stage)){ + continue; + } conf->cycle.current_action = action; struct cats_timer timer = start_new_timer(); diff --git a/src/cats/actions/setup_actions.c b/src/cats/actions/setup_actions.c index 5902def2fe0ca9b9d66fab8a3e208f9ab20c34ca..1c03f487fcc98b0dbbaf28132177801f26e7aa3c 100644 --- a/src/cats/actions/setup_actions.c +++ b/src/cats/actions/setup_actions.c @@ -280,7 +280,7 @@ const char *get_action_registry_name_from_id(const struct cats_configuration *co { const struct action_function_registry *registry = &conf->action_functions; if (id < 0 || id >= registry->count) { - log_message(LOG_ERROR, "%s: invalid id %d"); + log_message(LOG_ERROR, "%s: invalid id %d", __func__, id); exit(EXIT_FAILURE); } diff --git a/src/cats/configuration/check_configuration.c b/src/cats/configuration/check_configuration.c index 3f32ce38457edc78f026a6aaefcd8829fde70315..67260760f04b7d6167eadee33a4848c452a6f2e4 100644 --- a/src/cats/configuration/check_configuration.c +++ b/src/cats/configuration/check_configuration.c @@ -64,7 +64,7 @@ int rate_failed(cats_dt_rates value, char *name) int range_float_check_at_least(cats_dt_rates value, cats_dt_rates larger_than, char *name) { if (value < larger_than) { - log_message(LOG_ERROR, "%s out of range: is %d, has to be >= %d", name, value, larger_than); + log_message(LOG_ERROR, "%s out of range: is %Lf, has to be >= %Lf", name, value, larger_than); return 1; } diff --git a/src/cats/configuration/configuration.c b/src/cats/configuration/configuration.c index 6841aaf8e734673f2111fa02d7cdcfd47576c8aa..00b2e74cdf9cd6b010c1cbba272639006d68560e 100644 --- a/src/cats/configuration/configuration.c +++ b/src/cats/configuration/configuration.c @@ -192,7 +192,7 @@ void post_process_configuration(struct cats_configuration *conf) if (conf->command_line_options.lambda_years > 0) { years = conf->command_line_options.lambda_years; } - log_message(LOG_IMPORTANT, "overriding simulation length to %d for lambda test"); + log_message(LOG_IMPORTANT, "overriding simulation length to %d for lambda test", years); conf->time.simulation_length = years; conf->overlays.have_overlays = false; } diff --git a/src/cats/configuration/load_configuration.c b/src/cats/configuration/load_configuration.c index 8cb7da8df987b67c0cba6c743f35e107fb8e5a68..c02853f12d95ff385be9c6024062ecf91b4e32c5 100644 --- a/src/cats/configuration/load_configuration.c +++ b/src/cats/configuration/load_configuration.c @@ -179,7 +179,7 @@ void set_suitability_from_string(cats_dt_rates *value, const struct cats_species bool success = string_to_double(copy, &temp_value); if (success == false || isnan(temp_value)) { log_message(LOG_ERROR, - "could not interpret '%s' as suitability value", + "%s: could not interpret '%s' as suitability value", __func__, copy); exit_cats(EXIT_FAILURE); } diff --git a/src/cats/configuration/load_configuration_environments.c b/src/cats/configuration/load_configuration_environments.c index 0a3487589b07ff2fa98b7ce79c15e2589834e7f7..7059ee5d8db5f97b2353acd2da0532cefae472bd 100644 --- a/src/cats/configuration/load_configuration_environments.c +++ b/src/cats/configuration/load_configuration_environments.c @@ -38,7 +38,7 @@ enum environment_variable_type get_environment_variable_type_from_string(const c if (strcmp(string, "direct rate") == 0) return ENV_VAR_DIRECT; if (strcmp(string, "constant") == 0) return ENV_VAR_CONSTANT; - log_message(LOG_ERROR, "%s: unknown environment variable type '%s', valid values: 'predictor', 'suitability'"); + log_message(LOG_ERROR, "%s: unknown environment variable type '%s', valid values: 'predictor', 'suitability'", __func__, string); exit_cats(EXIT_FAILURE); } diff --git a/src/cats/data/cats_datatypes.c b/src/cats/data/cats_datatypes.c index f1fabcc09055222cb81941f8ae8487a43418cf7c..656cc83c12e316a8d15cf3e6bde07601296288b1 100644 --- a/src/cats/data/cats_datatypes.c +++ b/src/cats/data/cats_datatypes.c @@ -139,7 +139,7 @@ bool string_to_integer(char *string, int32_t *value) long converted = strtol(string, &end_pointer, 10); if (strlen(end_pointer) != 0) { - log_message(LOG_WARNING, "%s: invalid or unused characters when converting '%s' to integer %d: '%s'", + log_message(LOG_WARNING, "%s: invalid or unused characters when converting '%s' to integer %ld: '%s'", __func__, string, converted, end_pointer); return false; } diff --git a/src/cats/debug/debug.c b/src/cats/debug/debug.c index 1a44cbf43998c465a4722b3965d37aacaeeb780b..7bcf2379c4eaa52263a519358f3b55fa47819660 100644 --- a/src/cats/debug/debug.c +++ b/src/cats/debug/debug.c @@ -58,7 +58,7 @@ void reset_threading_grid(struct cats_debug_options *dbg) void mark_cell_done(struct cats_debug_options *dbg, cats_dt_coord row, cats_dt_coord col) { if (dbg->threading_grid[row][col] >= 0) { - log_message(LOG_ERROR, "cell %d %d has already been done"); + log_message(LOG_ERROR, "cell %d %d has already been done", row, col); exit(EXIT_FAILURE); } dbg->threading_grid[row][col] = timestamp(); diff --git a/src/cats/environment/environment.c b/src/cats/environment/environment.c index c87fbfc95f95fabdc3ce095cafa99b4c487fb5cc..0f85e76c9623f18e51cbf92d2eea08cf7fbbb382 100644 --- a/src/cats/environment/environment.c +++ b/src/cats/environment/environment.c @@ -142,7 +142,7 @@ load_environment_raster(struct cats_configuration *conf, struct cats_environment assert(raster != NULL); assert(filename != NULL); if (!environment->quiet) { - log_message(LOG_EMPTY, ""); + log_message(LOG_EMPTY, " "); log_message(LOG_INFO, "\t%s: loading <%s> from '%s' (year %d)", __func__, get_raster_type_name_specific(raster), filename, year); @@ -200,7 +200,7 @@ void save_suitability_from_glm(struct cats_grid *grid, struct cats_configuration #else #endif - log_message(LOG_ERROR, "%s: not implemented"); + log_message(LOG_ERROR, "%s: not implemented", __func__); } @@ -274,7 +274,7 @@ load_environment_interpolated(struct cats_configuration *conf, struct cats_envir } - log_message(LOG_EMPTY, ""); + log_message(LOG_EMPTY, " "); log_message(LOG_INFO, "\tcalculating current %s", name); float scale = get_interpolation_factor(year_start, year_end, year_target, @@ -289,7 +289,7 @@ load_environment_interpolated(struct cats_configuration *conf, struct cats_envir interpolate_environment(conf, environment); environment->current.year = year_target; - log_message(LOG_EMPTY, ""); + log_message(LOG_EMPTY, " "); log_message(LOG_INFO, "%s SUMMARY: now loaded for %s: start %d end %d", short_name, environment->pattern, environment->start.year, environment->end.year); print_raster_quick_info(&environment->start); diff --git a/src/cats/environment/environment_set.c b/src/cats/environment/environment_set.c index 9f461268014ffc5f5bed2e904cd7c1edc77eb1c3..bfa5e43e662d16d85370815825cc52f4d4b245f7 100644 --- a/src/cats/environment/environment_set.c +++ b/src/cats/environment/environment_set.c @@ -180,7 +180,7 @@ void failed_to_find_environment(const struct cats_configuration *conf, const cha { log_message(LOG_ERROR, "%s: could not find environment set '%s' in registry", __func__, name); if (conf->environment.names == NULL || conf->environment.names->count == 0) { - log_message(LOG_ERROR, "%s: registry empty", __func__, name); + log_message(LOG_ERROR, "%s: registry empty ('%s')", __func__, name); } else { for (int32_t i = 0; i < conf->environment.names->count; i++) { log_message(LOG_INFO, "%s: have registry entry: '%s'", __func__, diff --git a/src/cats/grids/cats_grid.c b/src/cats/grids/cats_grid.c index 996aa687217c9e529e777b5e22fd5a845b9e495c..e55be91ca49b16cd508e8835804d0ad288d5bfa5 100644 --- a/src/cats/grids/cats_grid.c +++ b/src/cats/grids/cats_grid.c @@ -229,7 +229,7 @@ int64_t raster_cell_count(struct cats_dimension raster) const int64_t cols = raster.cols; if (rows > INT64_MAX / cols) { - log_message(LOG_ERROR, "%s: possible integer overflow in %d * %d. Aborting.", raster.rows, raster.cols); + log_message(LOG_ERROR, "%s: possible integer overflow in %d * %d. Aborting.", __func__, raster.rows, raster.cols); exit(EXIT_FAILURE); } return rows * cols; diff --git a/src/cats/hybrid/scalefactor.c b/src/cats/hybrid/scalefactor.c index 67e25e62076312fb31386d4b9377482ab6ae8c33..defe588b36e578302fc9e6777ba658972cbcb963 100644 --- a/src/cats/hybrid/scalefactor.c +++ b/src/cats/hybrid/scalefactor.c @@ -173,7 +173,7 @@ cats_dt_rates calculate_scale_factor_from_lambda(struct cats_configuration *conf void set_scale_factor_all_species(struct cats_configuration *conf, cats_dt_rates scale_factor) { - log_message(LOG_INFO, "setting scale factor for all grids directly to %f", scale_factor); + log_message(LOG_INFO, "setting scale factor for all grids directly to %Lf", scale_factor); for (int id = 0; id < conf->grid_count; id++) { conf->param[id].scale_factor = scale_factor; } @@ -203,7 +203,7 @@ void setup_scale_factor(struct cats_configuration *conf, struct program_options if (options->direct_scale_factor > 0 && options->direct_scale_factor < 1) { conf->direct_scale_factor = options->direct_scale_factor; - log_message(LOG_IMPORTANT, "using pre-calculated scale factor %f", conf->direct_scale_factor); + log_message(LOG_IMPORTANT, "using pre-calculated scale factor %Lf", conf->direct_scale_factor); set_scale_factor_all_species(conf, conf->direct_scale_factor); return; } diff --git a/src/cats/inline_population.h b/src/cats/inline_population.h index 3333ef315ebe915fbaa3b0d9f6608e9bede5f9c3..b5a058e84b72a5c7e00013ac12227e1f879ed307 100644 --- a/src/cats/inline_population.h +++ b/src/cats/inline_population.h @@ -109,7 +109,7 @@ set_population_ignore_cc(const struct cats_grid *grid, const cats_dt_coord row, assert(grid->population[row] != NULL); if (pop > CATS_MAX_POPULATION || pop < 0.0) { - log_message(LOG_ERROR, "%s: population %Lf out of allowed population range [0, %d].", + log_message(LOG_ERROR, "%s: population %d out of allowed population range [0, %d].", __func__, pop, CATS_MAX_POPULATION); exit(EXIT_FAILURE); } diff --git a/src/cats/misc/cats_random.c b/src/cats/misc/cats_random.c index b1328c454ad0b65e0fcd29d77943c3673e298220..19ad7aca597ab4a6e986fbe3b3ffd333ce4a0e74 100644 --- a/src/cats/misc/cats_random.c +++ b/src/cats/misc/cats_random.c @@ -101,7 +101,7 @@ int32_t poisson_undampened(const gsl_rng *rng, cats_dt_rates value) if (result > CATS_MAX_POPULATION) { - log_message(LOG_WARNING, "poisson called on %Lf resulted in %d > %d, returning %d", + log_message(LOG_WARNING, "poisson called on %Lf resulted in %Lf > %d, returning %d", value, result, CATS_MAX_POPULATION, CATS_MAX_POPULATION); return CATS_MAX_POPULATION; } diff --git a/src/cats/mpi/mpi_grid_helpers.c b/src/cats/mpi/mpi_grid_helpers.c index a9b40dd7a312ab7d2df92ed1e35ff4f62002d3d8..fe4db03b266f8dfa043860ba5468b9a6edf8500c 100644 --- a/src/cats/mpi/mpi_grid_helpers.c +++ b/src/cats/mpi/mpi_grid_helpers.c @@ -38,7 +38,7 @@ int get_cell_count_single_grid(const struct cats_configuration *conf) { int64_t send_count_needed = raster_cell_count(conf->geometry.dimension); if (send_count_needed > INT_MAX) { - log_message(LOG_ERROR, "%s: too many elements to send via MPI"); + log_message(LOG_ERROR, "%s: too many elements to send via MPI", __func__); exit(EXIT_FAILURE); } int send_count = (int) send_count_needed; diff --git a/src/cats/populations/carrying_capacity.c b/src/cats/populations/carrying_capacity.c index a2c27857b9936b21764d8694316b553e1d75c7fb..a285ee516d61783de0b9c63054980ef7692b0f29 100644 --- a/src/cats/populations/carrying_capacity.c +++ b/src/cats/populations/carrying_capacity.c @@ -157,7 +157,7 @@ void apply_carrying_capacity(struct cats_grid *grid, struct cats_thread_info *ts return; } - log_message(LOG_ERROR, "%s:: reached point we should have not reached"); + log_message(LOG_ERROR, "%s:: reached point we should have not reached", __func__); exit(EXIT_FAILURE); } diff --git a/src/cats/vital_rates/setup_rates.c b/src/cats/vital_rates/setup_rates.c index a6d74631615b397eecd1f3666c6cb756a94731f3..4e07efed07025f535f41fa37ff8a0bf27ba068e9 100644 --- a/src/cats/vital_rates/setup_rates.c +++ b/src/cats/vital_rates/setup_rates.c @@ -207,7 +207,7 @@ void print_link(const struct cats_vital_rate_hybrid_function *link, int32_t coun { assert(link != NULL); if (link->type == LINK_MIN || link->type == LINK_MAX) return; - log_message(LOG_INFO, "\tlink function (id % 2d): '%s' ('%s') (type id: % 2d), max rate %", count, + log_message(LOG_INFO, "\tlink function (id % 2d): '%s' ('%s') (type id: % 2d)", count, link->description, link->short_name, link->type); }