![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <QLoggingCategory>#include <QString>#include <QtGlobal>#include <stdlib.h>
Include dependency graph for log.h:Go to the source code of this file.
Macros | |
| #define | __FC_LINE__ __LINE__ |
| #define | log_base(level, message, ...) |
| #define | log_debug(message, ...) |
| #define | log_test qInfo |
| #define | log_packet qDebug |
| #define | log_packet_detailed log_debug |
| #define | LOG_TEST LOG_NORMAL |
| #define | fc_assert(condition) |
| #define | fc_assert_msg(condition, message, ...) |
| #define | fc_assert_action(condition, action) |
| #define | fc_assert_ret(condition) fc_assert_action(condition, return ) |
| #define | fc_assert_ret_val(condition, val) fc_assert_action(condition, return val) |
| #define | fc_assert_exit(condition) fc_assert_action(condition, exit(EXIT_FAILURE)) |
| #define | fc_assert_action_msg(condition, action, message, ...) |
| #define | fc_assert_ret_msg(condition, message, ...) fc_assert_action_msg(condition, return, message, ##__VA_ARGS__) |
| #define | fc_assert_ret_val_msg(condition, val, message, ...) fc_assert_action_msg(condition, return val, message, ##__VA_ARGS__) |
| #define | fc_assert_exit_msg(condition, message, ...) |
| #define | FC_STATIC_STRLEN_ASSERT(cond, tag) |
| #define | FC_STATIC_ASSERT(cond, tag) enum { static_assert_##tag = 1 / (!!(cond)) } |
Functions | |
| void | log_close () |
| Deinitialize logging module. More... | |
| bool | log_init (const QString &level_str=QStringLiteral("info"), const QStringList &extra_rules={}) |
| Parses a log level string as provided by the user on the command line, and installs the corresponding Qt log filters. More... | |
| void | log_set_file (const QString &path) |
| Redirects the log to a file. More... | |
| const QString & | log_get_level () |
| Retrieves the log level passed to log_init (even if log_init failed). More... | |
| void | fc_assert_set_fatal (bool fatal_assertions) |
| Set what signal the assert* macros should raise on failed assertion (-1 to disable). More... | |
| bool | fc_assert_are_fatal () |
| Checks whether the fc_assert* macros should raise on failed assertion. More... | |
| void | fc_assert_handle_failure (const char *condition, const char *file, int line, const char *function, const QString &message=QString()) |
| Handles a failed assertion. More... | |
| void | log_time (const QString &msg, bool log=false) |
Variables | |
| constexpr auto | LOG_FATAL = QtFatalMsg |
| constexpr auto | LOG_ERROR = QtCriticalMsg |
| constexpr auto | LOG_WARN = QtWarningMsg |
| constexpr auto | LOG_NORMAL = QtInfoMsg |
| constexpr auto | LOG_VERBOSE = QtDebugMsg |
| constexpr auto | LOG_DEBUG = QtDebugMsg |
| #define fc_assert | ( | condition | ) |
| #define fc_assert_action | ( | condition, | |
| action | |||
| ) |
| #define fc_assert_exit | ( | condition | ) | fc_assert_action(condition, exit(EXIT_FAILURE)) |
| #define fc_assert_exit_msg | ( | condition, | |
| message, | |||
| ... | |||
| ) |
| #define fc_assert_msg | ( | condition, | |
| message, | |||
| ... | |||
| ) |
| #define fc_assert_ret | ( | condition | ) | fc_assert_action(condition, return ) |
| #define fc_assert_ret_msg | ( | condition, | |
| message, | |||
| ... | |||
| ) | fc_assert_action_msg(condition, return, message, ##__VA_ARGS__) |
| #define fc_assert_ret_val | ( | condition, | |
| val | |||
| ) | fc_assert_action(condition, return val) |
| #define fc_assert_ret_val_msg | ( | condition, | |
| val, | |||
| message, | |||
| ... | |||
| ) | fc_assert_action_msg(condition, return val, message, ##__VA_ARGS__) |
| #define FC_STATIC_ASSERT | ( | cond, | |
| tag | |||
| ) | enum { static_assert_##tag = 1 / (!!(cond)) } |
| #define LOG_TEST LOG_NORMAL |
| bool fc_assert_are_fatal | ( | ) |
Checks whether the fc_assert* macros should raise on failed assertion.
Definition at line 231 of file log.cpp.
Referenced by fc_assert_handle_failure().
| void fc_assert_handle_failure | ( | const char * | condition, |
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| const QString & | message = QString() |
||
| ) |
| void fc_assert_set_fatal | ( | bool | fatal_assertions | ) |
Set what signal the assert* macros should raise on failed assertion (-1 to disable).
Definition at line 226 of file log.cpp.
Referenced by client_main(), main(), re_parse_cmdline(), and rup_parse_cmdline().
| void log_close | ( | ) |
Deinitialize logging module.
Definition at line 212 of file log.cpp.
Referenced by client_exit(), con_log_close(), fcmp_deinit(), and main().
| const QString& log_get_level | ( | ) |
Retrieves the log level passed to log_init (even if log_init failed).
This can be overridden from the environment, so it's only useful when passing it to the server from the client.
Definition at line 207 of file log.cpp.
Referenced by client_start_server().
| bool log_init | ( | const QString & | level_str, |
| const QStringList & | extra_rules | ||
| ) |
Parses a log level string as provided by the user on the command line, and installs the corresponding Qt log filters.
Prints a warning and returns false if the log level name isn't known.
Additional logging rules can be passed in Qt format.
Definition at line 55 of file log.cpp.
Referenced by client_main(), fcmp_parse_cmdline(), and main().
| void log_set_file | ( | const QString & | path | ) |
Redirects the log to a file.
It will still be shown on standard error. This function is not thread-safe.
Definition at line 177 of file log.cpp.
Referenced by client_main(), and con_log_init().
| void log_time | ( | const QString & | msg, |
| bool | log = false |
||
| ) |
Definition at line 253 of file log.cpp.
Referenced by auto_settlers_player(), freeciv::server::begin_phase(), begin_phase(), begin_turn(), end_phase(), end_turn(), handle_conn_pong(), main(), and save_game().
|
constexpr |
Definition at line 27 of file log.h.
Referenced by adjust_improvement_wants_by_effects(), adv_unit_execute_path(), adv_unit_move(), aiguard_check_charge_unit(), aiguard_check_guard(), auto_arrange_workers(), auto_settler_setup_work(), ba_human_wants(), building_advisor(), building_advisor_choose(), check_tilespec_capabilities(), city_map_update_radius_sq(), contemplate_new_city(), contemplate_terrain_improvements(), dai_airlift(), dai_auto_settler_run(), dai_build_adv_adjust(), dai_build_adv_override(), dai_choose_diplomat_defensive(), dai_choose_help_wonder(), dai_choose_trade_route(), dai_city_choose_build(), dai_diplomacy_actions(), dai_diplomacy_begin_new_phase(), dai_goldequiv_clause(), dai_log_path(), dai_manage_airunit(), dai_manage_barbarian_leader(), dai_manage_government(), dai_manage_military(), dai_manage_tech(), dai_manage_unit(), dai_military_attack(), dai_military_attack_barbarian(), dai_military_bodyguard(), dai_military_defend(), dai_military_findjob(), dai_process_defender_want(), dai_rampage_want(), dai_select_tech(), dai_set_defenders(), dai_unit_bodyguard_move(), dai_unit_goto(), dai_unit_goto_constrained(), dai_unit_move(), dai_unit_new_task(), dai_wants_defender_against(), dai_wants_role_unit(), dai_war_desire(), domestic_advisor_choose_build(), explorer_goto(), find_best_city_placement(), find_best_tile_to_paradrop_to(), find_something_to_kill(), generate_city_map_indices(), kill_something_with(), luascript_callback_invoke(), luascript_common_a_register(), military_advisor_choose_build(), process_attacker_want(), script_fcdb_cmd_reply(), settler_evaluate_improvements(), and want_tech_for_improvement_effect().
|
constexpr |
Definition at line 23 of file log.h.
Referenced by freeciv::layer_terrain::add_tag(), api_edit_create_unit_full(), check_tilespec_capabilities(), freeciv::layer_terrain::create_matching_group(), dai_city_choose_build(), dai_diplomat_city(), dai_go_to_war(), dai_manage_diplomat(), dai_manage_taxes(), freeciv::layer_terrain::enable_blending(), freeciv::layer_terrain::group(), freeciv::layer_terrain::initialize_blending(), freeciv::layer_terrain::initialize_cell_corner_match_full(), freeciv::layer_terrain::initialize_cell_corner_match_none(), freeciv::layer_terrain::initialize_cell_corner_match_pair(), freeciv::layer_terrain::initialize_cell_corner_match_same(), freeciv::layer_terrain::initialize_cell_hex_corner(), freeciv::layer_terrain::initialize_cell_whole_match_none(), freeciv::layer_terrain::initialize_cell_whole_match_same(), freeciv::layer_terrain::initialize_terrain(), load_sprite(), luascript_callback_invoke(), luascript_common_a_register(), luascript_func_add_valist(), luascript_func_call_valist(), luascript_func_is_required(), luascript_report(), luascript_signal_create_valist(), luascript_signal_emit_valist(), luascript_vars_save(), options_save(), script_client_output(), script_fcdb_cmd_reply(), script_server_cmd_reply(), and tileset_read_toplevel().
|
constexpr |
Definition at line 22 of file log.h.
Referenced by ensure_big_sprite(), freeciv::layer_city::initialize_city_style(), load_sprite(), freeciv::layer_darkness::load_sprites(), freeciv::layer_overlays::load_sprites(), luascript_common_a_register(), scan_specfile(), script_client_output(), script_fcdb_cmd_reply(), script_server_cmd_reply(), tileset_lookup_sprite_tags(), tileset_setup_citizen_types(), tileset_setup_extra(), tileset_setup_government(), tileset_setup_nation_flag(), tileset_setup_specialist_type(), tileset_setup_unit_type(), and tilespec_try_read().
|
constexpr |
Definition at line 25 of file log.h.
Referenced by api_edit_create_player(), dai_caravan_goto(), debug_command(), handle_map_info(), load_sprite(), luascript_common_a_register(), script_client_output(), script_fcdb_cmd_reply(), script_server_cmd_reply(), and tilespec_reread().
|
constexpr |
Definition at line 26 of file log.h.
Referenced by assess_defense_quadratic(), dai_caravan_goto(), dai_manage_unit(), dai_military_defend(), freeciv::layer_terrain::initialize_blending(), luascript_common_a_register(), options_save(), script_client_output(), script_server_cmd_reply(), tileset_setup_impr_type(), tileset_setup_tech_type(), and units_view::units_view().
|
constexpr |
Definition at line 24 of file log.h.
Referenced by freeciv::layer_terrain::initialize_terrain(), luascript_common_a_register(), script_client_output(), script_fcdb_cmd_reply(), and script_server_cmd_reply().