Freeciv-3.2
Loading...
Searching...
No Matches
srv_log.h
Go to the documentation of this file.
1/**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__SRV_LOG_H
14#define FC__SRV_LOG_H
15
16/* utility */
17#include "bitvector.h"
18#include "log.h"
19#include "support.h"
20
21/* common */
22#include "fc_types.h"
23
24struct ai_data;
25
26/*
27 * Change these and remake to watch logs from a specific
28 * part of the AI code.
29 */
30#define LOGLEVEL_BODYGUARD LOG_DEBUG
31#define LOGLEVEL_UNIT LOG_DEBUG
32#define LOGLEVEL_GOTO LOG_DEBUG
33#define LOGLEVEL_CITY LOG_DEBUG
34#define LOGLEVEL_BUILD LOG_DEBUG
35#define LOGLEVEL_HUNT LOG_DEBUG
36#define LOGLEVEL_PLAYER LOG_DEBUG
37
38#define LOG_AI_TEST LOG_NORMAL
39
74
78
79void real_city_log(const char *file, const char *function, int line,
80 enum log_level level, bool notify,
81 const struct city *pcity, const char *msg, ...)
83#define CITY_LOG(loglevel, pcity, msg, ...) \
84{ \
85 bool notify = pcity->server.debug; \
86 enum log_level level = (notify ? LOG_AI_TEST \
87 : MIN(loglevel, LOGLEVEL_CITY)); \
88 if (log_do_output_for_level(level)) { \
89 real_city_log(__FILE__, __FUNCTION__, __FC_LINE__, level, notify, \
90 pcity, msg, ## __VA_ARGS__); \
91 } \
92}
93
94void real_unit_log(const char *file, const char *function, int line,
95 enum log_level level, bool notify,
96 const struct unit *punit, const char *msg, ...)
98#define UNIT_LOG(loglevel, punit, msg, ...) \
99{ \
100 bool notify = punit->server.debug; \
101 enum log_level level; \
102 if (notify || (tile_city(unit_tile(punit)) \
103 && tile_city(unit_tile(punit))->server.debug)) { \
104 level = LOG_AI_TEST; \
105 notify = TRUE; \
106 } else { \
107 level = MIN(loglevel, LOGLEVEL_UNIT); \
108 } \
109 if (log_do_output_for_level(level)) { \
110 real_unit_log(__FILE__, __FUNCTION__, __FC_LINE__, level, notify, \
111 punit, msg, ## __VA_ARGS__); \
112 } \
113}
114
115void timing_log_init(void);
116void timing_log_free(void);
117
118void timing_log_real(enum ai_timer timer, enum ai_timer_activity activity);
119void timing_results_real(void);
120
121#ifdef FREECIV_DEBUG
122#define TIMING_LOG(timer, activity) timing_log_real(timer, activity)
123#define TIMING_RESULTS() timing_results_real()
124#else /* FREECIV_DEBUG */
125#define TIMING_LOG(timer, activity)
126#define TIMING_RESULTS()
127#endif /* FREECIV_DEBUG */
128
129#endif /* FC__SRV_LOG_H */
char * incite_cost
Definition comments.c:75
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
log_level
Definition log.h:28
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
void timing_log_init(void)
Definition srv_log.c:218
void real_city_log(const char *file, const char *function, int line, enum log_level level, bool notify, const struct city *pcity, const char *msg,...) fc__attribute((__format__(__printf__
void real_unit_log(const char *file, const char *function, int line, enum log_level level, bool notify, const struct unit *punit, const char *msg,...) fc__attribute((__format__(__printf__
ai_timer
Definition srv_log.h:40
@ AIT_RECOVER
Definition srv_log.h:68
@ AIT_FSTK
Definition srv_log.h:54
@ AIT_GOVERNMENT
Definition srv_log.h:47
@ AIT_CARAVAN
Definition srv_log.h:56
@ AIT_RAMPAGE
Definition srv_log.h:71
@ AIT_CITY_MILITARY
Definition srv_log.h:63
@ AIT_BUILDINGS
Definition srv_log.h:51
@ AIT_TAXES
Definition srv_log.h:48
@ AIT_ATTACK
Definition srv_log.h:66
@ AIT_HUNTER
Definition srv_log.h:57
@ AIT_BODYGUARD
Definition srv_log.h:69
@ AIT_DEFENDERS
Definition srv_log.h:55
@ AIT_SETTLERS
Definition srv_log.h:44
@ AIT_UNITS
Definition srv_log.h:43
@ AIT_CITIES
Definition srv_log.h:49
@ AIT_AIRUNIT
Definition srv_log.h:60
@ AIT_EXPLORER
Definition srv_log.h:61
@ AIT_TECH
Definition srv_log.h:53
@ AIT_CITY_TERRAIN
Definition srv_log.h:64
@ AIT_FERRY
Definition srv_log.h:70
@ AIT_MILITARY
Definition srv_log.h:67
@ AIT_ALL
Definition srv_log.h:41
@ AIT_MOVEMAP
Definition srv_log.h:42
@ AIT_WORKERS
Definition srv_log.h:45
@ AIT_DIPLOMAT
Definition srv_log.h:59
@ AIT_LAST
Definition srv_log.h:72
@ AIT_AIDATA
Definition srv_log.h:46
@ AIT_AIRLIFT
Definition srv_log.h:58
@ AIT_CITIZEN_ARRANGE
Definition srv_log.h:50
@ AIT_CITY_SETTLERS
Definition srv_log.h:65
@ AIT_DANGER
Definition srv_log.h:52
@ AIT_EMERGENCY
Definition srv_log.h:62
void timing_log_free(void)
Definition srv_log.c:236
void timing_results_real(void)
Definition srv_log.c:157
ai_timer_activity
Definition srv_log.h:75
@ TIMER_STOP
Definition srv_log.h:76
@ TIMER_START
Definition srv_log.h:76
void timing_log_real(enum ai_timer timer, enum ai_timer_activity activity)
Definition srv_log.c:129
Definition city.h:320
Definition timing.c:81
Definition unit.h:138
#define fc__attribute(x)
Definition support.h:99