Freeciv-3.2: /fast/freeciv/nightly/S3_2/server/srv_log.h File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Macros | Enumerations | Functions
srv_log.h File Reference
`#include "bitvector.h"`
`#include "log.h"`
`#include "support.h"`
`#include "fc_types.h"`

Go to the source code of this file.

## Macros

#define | LOGLEVEL_BODYGUARD LOG_DEBUG
#define | LOGLEVEL_UNIT LOG_DEBUG
#define | LOGLEVEL_GOTO LOG_DEBUG
#define | LOGLEVEL_CITY LOG_DEBUG
#define | LOGLEVEL_BUILD LOG_DEBUG
#define | LOGLEVEL_HUNT LOG_DEBUG
#define | LOGLEVEL_PLAYER LOG_DEBUG
#define | LOG_AI_TEST LOG_NORMAL
#define | CITY_LOG(loglevel, pcity, msg, ...)
#define | UNIT_LOG(loglevel, punit, msg, ...)
#define | TIMING_LOG(timer, activity)
#define | TIMING_RESULTS()

## Enumerations

enum

ai_timer {
AIT_ALL , AIT_MOVEMAP , AIT_UNITS , AIT_SETTLERS ,
AIT_WORKERS , AIT_AIDATA , AIT_GOVERNMENT , AIT_TAXES ,
AIT_CITIES , AIT_CITIZEN_ARRANGE , AIT_BUILDINGS , AIT_DANGER ,
AIT_TECH , AIT_FSTK , AIT_DEFENDERS , AIT_CARAVAN ,
AIT_HUNTER , AIT_AIRLIFT , AIT_DIPLOMAT , AIT_AIRUNIT ,
AIT_EXPLORER , AIT_EMERGENCY , AIT_CITY_MILITARY , AIT_CITY_TERRAIN ,
AIT_CITY_SETTLERS , AIT_ATTACK , AIT_MILITARY , AIT_RECOVER ,
AIT_BODYGUARD , AIT_FERRY , AIT_RAMPAGE , AIT_LAST
}

enum | ai_timer_activity { TIMER_START , TIMER_STOP }

## Functions

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__
void | timing_log_init (void)
void | timing_log_free (void)
void | timing_log_real (enum ai_timer timer, enum ai_timer_activity activity)
void | timing_results_real (void)

## Macro Definition Documentation

## ◆ CITY_LOG

#define CITY_LOG | ( |  | loglevel,
|  |  | pcity,
|  |  | msg,
|  |  | ...
| ) |  |

Value:
{ \
bool notify = pcity->server.debug; \
enum log_level level = (notify ? LOG_AI_TEST \
: MIN(loglevel, LOGLEVEL_CITY)); \
if (log_do_output_for_level(level)) { \
real_city_log(__FILE__, __FUNCTION__, __FC_LINE__, level, notify, \
pcity, msg, ## __VA_ARGS__); \
} \
}
incite_cost
char * incite_cost
Definition comments.c:74
__FC_LINE__
#define __FC_LINE__
Definition log.h:40
log_do_output_for_level
#define log_do_output_for_level(level)
Definition log.h:89
log_level
log_level
Definition log.h:28
level
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
MIN
#define MIN(x, y)
Definition shared.h:55
LOGLEVEL_CITY
#define LOGLEVEL_CITY
Definition srv_log.h:33
LOG_AI_TEST
#define LOG_AI_TEST
Definition srv_log.h:38

Definition at line 83 of file srv_log.h.

## ◆ LOG_AI_TEST

#define LOG_AI_TEST LOG_NORMAL

Definition at line 38 of file srv_log.h.

## ◆ LOGLEVEL_BODYGUARD

#define LOGLEVEL_BODYGUARD LOG_DEBUG

Definition at line 30 of file srv_log.h.

## ◆ LOGLEVEL_BUILD

#define LOGLEVEL_BUILD LOG_DEBUG

Definition at line 34 of file srv_log.h.

## ◆ LOGLEVEL_CITY

#define LOGLEVEL_CITY LOG_DEBUG

Definition at line 33 of file srv_log.h.

## ◆ LOGLEVEL_GOTO

#define LOGLEVEL_GOTO LOG_DEBUG

Definition at line 32 of file srv_log.h.

## ◆ LOGLEVEL_HUNT

#define LOGLEVEL_HUNT LOG_DEBUG

Definition at line 35 of file srv_log.h.

## ◆ LOGLEVEL_PLAYER

#define LOGLEVEL_PLAYER LOG_DEBUG

Definition at line 36 of file srv_log.h.

## ◆ LOGLEVEL_UNIT

#define LOGLEVEL_UNIT LOG_DEBUG

Definition at line 31 of file srv_log.h.

## ◆ TIMING_LOG

#define TIMING_LOG | ( |  | timer,
|  |  | activity
| ) |  |

Definition at line 125 of file srv_log.h.

## ◆ TIMING_RESULTS

#define TIMING_RESULTS | ( |  | ) |

Definition at line 126 of file srv_log.h.

## ◆ UNIT_LOG

#define UNIT_LOG | ( |  | loglevel,
|  |  | punit,
|  |  | msg,
|  |  | ...
| ) |  |

Value:
{ \
bool notify = punit->server.debug; \
enum log_level level; \
if (notify || (tile_city(unit_tile(punit)) \
&& tile_city(unit_tile(punit))->server.debug)) { \
level = LOG_AI_TEST; \
notify = TRUE; \
} else { \
level = MIN(loglevel, LOGLEVEL_UNIT); \
} \
if (log_do_output_for_level(level)) { \
real_unit_log(__FILE__, __FUNCTION__, __FC_LINE__, level, notify, \
punit, msg, ## __VA_ARGS__); \
} \
}
punit
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
LOGLEVEL_UNIT
#define LOGLEVEL_UNIT
Definition srv_log.h:31
server
Definition servers.h:29
unit::debug
bool debug
Definition unit.h:234
unit::server
struct unit::@81::@84 server
TRUE
#define TRUE
Definition support.h:46
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
unit_tile
#define unit_tile(_pu)
Definition unit.h:390

Definition at line 98 of file srv_log.h.

## Enumeration Type Documentation

## ◆ ai_timer

enum ai_timer

Enumerator
AIT_ALL |
AIT_MOVEMAP |
AIT_UNITS |
AIT_SETTLERS |
AIT_WORKERS |
AIT_AIDATA |
AIT_GOVERNMENT |
AIT_TAXES |
AIT_CITIES |
AIT_CITIZEN_ARRANGE |
AIT_BUILDINGS |
AIT_DANGER |
AIT_TECH |
AIT_FSTK |
AIT_DEFENDERS |
AIT_CARAVAN |
AIT_HUNTER |
AIT_AIRLIFT |
AIT_DIPLOMAT |
AIT_AIRUNIT |
AIT_EXPLORER |
AIT_EMERGENCY |
AIT_CITY_MILITARY |
AIT_CITY_TERRAIN |
AIT_CITY_SETTLERS |
AIT_ATTACK |
AIT_MILITARY |
AIT_RECOVER |
AIT_BODYGUARD |
AIT_FERRY |
AIT_RAMPAGE |
AIT_LAST |

Definition at line 40 of file srv_log.h.

## ◆ ai_timer_activity

enum ai_timer_activity

Enumerator
TIMER_START |
TIMER_STOP |

Definition at line 75 of file srv_log.h.

## Function Documentation

## ◆ real_city_log()

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,
|  |  | ...
| ) |  |

## ◆ real_unit_log()

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,
|  |  | ...
| ) |  |

## ◆ timing_log_free()

void timing_log_free | ( | void |  | ) |

Free AI timing system resources

Definition at line 236 of file srv_log.c.

Referenced by server_quit().

## ◆ timing_log_init()

void timing_log_init | ( | void |  | ) |

Initialize AI timing system

Definition at line 218 of file srv_log.c.

Referenced by srv_init().

## ◆ timing_log_real()

void timing_log_real | ( | enum ai_timer | timer,
|  | enum ai_timer_activity | activity
| ) |  |

Measure the time between the calls. Used to see where in the AI too much CPU is being used.

Definition at line 129 of file srv_log.c.

## ◆ timing_results_real()

void timing_results_real | ( | void |  | ) |

Print results

Definition at line 157 of file srv_log.c.