Crossfire Server, Trunk
logger.cpp File Reference
#include "global.h"
#include <stdarg.h>
#include <stdlib.h>
#include "sproto.h"
#include "stats.h"
+ Include dependency graph for logger.cpp:

Go to the source code of this file.

Functions

void LOG (LogLevel logLevel, const char *format,...)
 

Variables

int log_total = 0
 
const char *const loglevel_names []
 
int maps_loaded_total = 0
 
int maps_saved_total = 0
 
int maps_swapped_total = 0
 
int reopen_logfile = 0
 

Detailed Description

This handles logging, to file or strerr/stdout.

Definition in file logger.cpp.

Function Documentation

◆ LOG()

void LOG ( LogLevel  logLevel,
const char *  format,
  ... 
)

Logs a message to stderr, or to file. Or discards the message if it is of no importance, and none have asked to hear messages of that logLevel.

See include/logger.h for possible logLevels. Messages with llevInfo and llevError are always printed, regardless of debug mode.

Parameters
logLevellevel of the message
formatmessage to log. Works like printf() and such

Definition at line 58 of file logger.cpp.

References buf, clean_tmp_files(), Settings::debug, emergency_save(), exiting, llevError, llevInfo, Settings::log_callback, Settings::log_timestamp, Settings::log_timestamp_format, log_total, logfile, Settings::logfilename, loglevel_names, MAX_ERRORS, nroferrors, reopen_logfile, settings, TRUE, and trying_emergency_save.

Referenced by account_add_player_cmd(), account_alloc(), account_char_load_from_file(), account_login_cmd(), account_new_cmd(), account_password(), account_play_cmd(), accounts_load(), add_abilities(), add_book(), add_book_to_list(), add_button_link(), add_friendly_object(), add_god_to_list(), add_npcs_to_map(), add_object_to_socklist(), add_one_item(), add_to_tar(), adj_attackroll(), alchemy_failure_effect(), allocate_map(), animate_object(), animate_weapon(), append_spell(), apply_builder_remove(), apply_cmd(), apply_container(), apply_map_builder(), apply_special(), arch_to_object(), arrow_type_process(), artifact_describe(), ask_smooth_cmd(), assets_collect(), assets_pack(), attempt_do_alchemy(), attempt_recipe(), blocked_link(), bufferreader_init_from_file(), calc_alch_danger(), calc_skill_exp(), can_pay(), cast_cone(), cast_consecrate(), cast_create_missile(), cast_create_town_portal(), cast_dust(), cast_light(), cast_spell(), cast_wonder(), cast_word_of_recall(), cfapi_log(), cfapi_object_delete(), cfapi_object_insert(), cfapi_object_remove(), cfapi_player_knowledge(), cfapi_player_quest(), change_attr_value(), change_book(), change_exp(), change_object(), check_altar_sacrifice(), check_formulae(), check_loaded_object(), check_login(), check_password(), check_recipe(), check_shutdown(), check_spells(), check_treasurelist(), check_trigger(), check_zone(), checkbanned(), checkdm(), clean_friendly_list(), cleanup(), close_modules(), command_arrest(), command_banish(), command_create(), command_execute(), command_knowledge(), command_loadplugin(), command_pickup(), command_quest(), command_reset(), command_shutdown(), command_unloadplugin(), command_whereabouts(), common_pre_ob_move_on(), common_process_projectile(), content_recipe_value(), copy_file(), create_one_treasure(), create_player_cmd(), create_treasure(), dead_player(), deathstrike_living(), deep_swamp_type_process(), delete_map(), determine_holy_arch(), die_roll(), display_who_entry(), do_each_skill(), do_execute_event(), do_forget_spell(), do_harvest(), do_item_conversion(), do_learn_spell(), do_module(), do_mood_floor(), do_server(), do_single_item(), do_skill(), do_skill_attack(), do_throw(), dragon_ability_gain(), draw_client_map(), draw_ext_info(), draw_ext_info_format(), draw_magic_map(), dump(), dump_alchemy(), dump_alchemy_costs(), dump_all_archetypes(), dump_map(), emergency_save(), ensure_available_characters(), enter_exit(), enter_fixed_template_map(), enter_map(), enter_player_maplevel(), enter_player_savebed(), enter_unique_map(), esrv_add_spells(), esrv_draw_look(), esrv_move_object(), esrv_remove_spell(), esrv_send_animation(), esrv_send_face(), esrv_update_stats(), eventListener(), events_register_object_handler(), events_unregister_object_handler(), examine_autoidentify(), examine_cmd(), expand_lighted_sight(), explode_bullet(), face_player(), find_applied_skill_by_name(), find_color(), find_doors_in_room_recursive(), find_recipe(), find_skill_by_name(), find_throw_ob(), find_title(), find_transmution_ob(), finish_races(), fire_arch_from_position(), fire_bow(), fire_misc_object(), fix_flesh_item(), fix_generated_item(), fix_object(), fix_summon_pet(), fix_weight(), flee_player(), flush_old_maps(), follower_level_to_enchantments(), food_type_apply(), forbid_play(), free_all_maps(), free_all_newserver(), free_all_objects(), free_all_readable(), free_all_recipes(), free_map(), free_newsocket(), free_player(), free_races(), free_style_maps(), gate_type_process(), generate_artifact(), generate_monster_arch(), generate_monster_inv(), generate_treasure(), get_attack_mode(), get_face_fallback(), get_jail_exit(), get_name_of_region_for_map(), get_npc(), get_player_archetype(), get_random_mon(), get_random_recipelist(), get_region_by_name(), get_region_longname(), get_region_msg(), get_titlelist(), get_typedata_by_name(), give_initial_items(), give_skill_by_name(), god_enchants_weapon(), god_info_msg(), god_intervention(), handle_cmd(), hiscore_check(), hiscore_display(), hiscore_load(), hit_map(), hit_player(), hit_with_one_attacktype(), i18n_init(), identify_altar_type_move_on(), improve_armour(), improve_weapon(), init(), init_attackmess(), init_book_archive(), init_clocks(), init_connection(), init_dynamic(), init_emergency_mappath(), init_experience(), init_formulae(), init_globals(), init_gods(), init_library(), init_listening_socket(), init_modules(), init_mon_info(), init_readable(), init_regions(), init_server(), init_startup(), init_stats(), initPlugins(), inscribe_scroll_cmd(), is_defined_recipe(), key_change_class(), key_roll_stat(), kill_object(), knowledge_alchemy_attempt(), knowledge_alchemy_face(), knowledge_give(), knowledge_god_add(), knowledge_god_detail(), knowledge_god_validate(), knowledge_player_knows(), knowledge_read_player_data(), learn_skill(), leave(), legal_artifact_combination(), level_for_item(), list_modules(), ArtifactLoader::load(), FacesetLoader::load(), MessageLoader::load(), PngLoader::load(), FaceLoader::load(), QuestLoader::load(), TreasureLoader::load(), load_and_link_tiled_map(), load_bells(), load_citylife(), load_map_header(), load_materials(), load_object(), load_object_from_reader(), load_objects(), load_overlay_map(), load_races(), load_settings(), load_table_float(), load_table_int(), load_temporary_map(), load_unique_objects(), FaceLoader::loadAnimationBlock(), TreasureLoader::loadTreasure(), local_check_loaded_object(), lock_item_cmd(), look_at_cmd(), lookup_spell_by_name(), magic_from_difficulty(), magic_wall(), main(), make_formula_book(), make_item_from_recipe(), make_object_glow(), make_path_to_file(), make_throw_ob(), map2_add_label(), map2_add_ob(), map_find_by_archetype(), map_remove_unique_files(), mapfile_load(), mapfile_load_lowlevel(), mark_item_cmd(), metaserver2_init(), metaserver2_updates(), monster_can_detect_enemy(), monster_cast_spell(), monster_check_apply(), monster_communicate(), monster_find_throw_ob(), monster_move(), monster_npc_call_help(), monster_use_bow(), monster_use_range(), monster_use_skill(), mood_change(), move_cmd(), move_cone(), move_creator(), move_detector(), move_duplicator(), move_firewall(), move_player(), move_player_mover(), move_symptom(), move_teleporter(), msgfile_msg(), new_connection(), new_player_cmd(), numb_ob_inside(), object_dump_all(), object_fix_multipart(), object_free(), object_free_all_data(), object_get_owner_const(), object_insert_in_map(), object_insert_in_ob(), object_merge_spell(), object_new(), object_remove(), object_set_enemy(), object_split(), object_update(), object_update_speed(), of_close(), of_open(), operate_altar(), parse_dialog_information(), parse_shop_string(), LicenseManager::parseLicenseFile(), party_remove(), path_combine(), path_normalize(), pay_for_amount(), pay_for_item(), pay_from_container(), peacemaker_type_process(), pets_attempt_follow(), pets_follow_owner(), pets_move(), pets_move_golem(), pets_should_arena_attack(), pets_summon_golem(), pets_summon_object(), pick_up(), place_special_exit(), player_can_view(), player_changer_type_process(), player_get_delayed_buffer(), plugins_init_plugin(), poison_living(), poison_type_apply(), poisoning_type_process(), polymorph_item(), price_approx(), process_events(), process_object(), query_money(), quest_find_by_code(), quest_get_step(), quest_read_player_data(), quest_set_state(), quest_start(), races_get_random_monster(), random_roll(), random_roll64(), read_map_log(), LicenseManager::readLicense(), receive_player_password(), remove_button_link(), remove_directory(), remove_friendly_object(), remove_special_prayers(), reply_cmd(), request_info_cmd(), resurrect_player(), save_life(), save_map(), save_object_in_sb(), save_objects(), save_player(), save_throw_object(), sell_item(), send_arch_info(), send_class_info(), send_exp_table(), send_face_cmd(), send_file(), send_image_sums(), send_news(), send_race_info(), send_rules(), send_skill_extra(), send_skill_info(), send_smooth(), send_spell_paths(), send_updates(), server_main(), set_block(), set_body_info(), set_csport(), set_move(), set_output_sock_buf(), set_up_cmd(), shop_inventory_type_apply(), shop_mat_type_move_on(), shop_price_buy(), shop_price_sell(), shop_specialisation_ratio(), skill_ident(), SockList_AddPrintf(), SockList_ReadPacket(), SP_level_spellpoint_cost(), spellbook_type_apply(), ss_dump_table(), START_TEST(), swap_map(), swap_stat(), tailor_god_spell(), tear_down_wall(), teleport(), tempnam_secure(), thrown_object_type_process(), town_portal_destroy_existing(), town_portal_find_force(), transmute_materialname(), trigger_connected(), unapply_special(), update_button(), update_buttons(), update_players(), update_position(), use_skill(), value_limit(), verify_player(), version_cmd(), while(), write_book_archive(), write_mark(), Write_To_Socket(), wrong_password(), and yyerror().

+ Here is the call graph for this function:

Variable Documentation

◆ log_total

int log_total = 0

Definition at line 43 of file logger.cpp.

Referenced by LOG().

◆ loglevel_names

const char* const loglevel_names[]
Initial value:
= {
"[EE] ",
"[II] ",
"[DD] ",
"[MM] ",
}

Human-readable name of log levels.

Definition at line 32 of file logger.cpp.

Referenced by ResourcesManager::load(), and LOG().

◆ maps_loaded_total

int maps_loaded_total = 0

Definition at line 39 of file logger.cpp.

Referenced by mapfile_load().

◆ maps_saved_total

int maps_saved_total = 0

Definition at line 40 of file logger.cpp.

Referenced by save_map().

◆ maps_swapped_total

int maps_swapped_total = 0

Definition at line 41 of file logger.cpp.

Referenced by swap_map().

◆ reopen_logfile

int reopen_logfile = 0

Definition at line 27 of file logger.cpp.

Referenced by LOG(), and rec_sighup().