19 #include <QLoggingCategory>
21 Q_DECLARE_LOGGING_CATEGORY(ai_category)
26 const struct city *pcity);
28 const struct unit *punit);
32 #define TECH_LOG(ait, _, pplayer, padvance, msg, ...) \
34 bool notify = BV_ISSET(pplayer->server.debug, PLAYER_DEBUG_TECH); \
35 QString message = tech_log_prefix(ait, pplayer, padvance) \
36 + QStringLiteral(" ") \
37 + QString::asprintf(msg, ##__VA_ARGS__); \
39 qCInfo(ai_category).noquote() << message; \
40 notify_conn(nullptr, nullptr, E_AI_DEBUG, ftc_log, "%s", \
41 qUtf8Printable(message)); \
43 qCDebug(ai_category).noquote() << message; \
49 #define DIPLO_LOG(ait, loglevel, pplayer, aplayer, msg, ...) \
51 bool notify = BV_ISSET(pplayer->server.debug, PLAYER_DEBUG_DIPLOMACY); \
52 QString message = diplo_log_prefix(ait, pplayer, aplayer) \
53 + QStringLiteral(" ") \
54 + QString::asprintf(msg, ##__VA_ARGS__); \
56 qCInfo(ai_category).noquote() << message; \
57 notify_conn(nullptr, nullptr, E_AI_DEBUG, ftc_log, "%s", \
58 qUtf8Printable(message)); \
60 qCDebug(ai_category).noquote() << message; \
65 #define BODYGUARD_LOG(ait, loglevel, punit, msg, ...) \
67 bool notify = punit->server.debug; \
68 QString message = bodyguard_log_prefix(ait, punit) \
69 + QStringLiteral(" ") \
70 + QString::asprintf(msg, ##__VA_ARGS__); \
72 qCInfo(ai_category).noquote() << message; \
73 notify_conn(nullptr, nullptr, E_AI_DEBUG, ftc_log, "%s", \
74 qUtf8Printable(message)); \
76 qCDebug(ai_category).noquote() << message; \
QString diplo_log_prefix(ai_type *ait, const player *pplayer, const player *aplayer)
Log player messages, they will appear like this.
void dai_unit_log(struct ai_type *ait, char *buffer, int buflength, const struct unit *punit)
Produce logline fragment for srv_log.
QString bodyguard_log_prefix(ai_type *ait, const unit *punit)
Log message for bodyguards.
QString tech_log_prefix(ai_type *ait, const player *pplayer, advance *padvance)
Log player tech messages.
void dai_city_log(struct ai_type *ait, char *buffer, int buflength, const struct city *pcity)
Produce logline fragment for srv_log.