[freeciv-ai] Re: rfc: logging
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Aug 12, 2002 at 10:18:23PM +0000, Per I. Mathisen wrote:
> In the attached patch I have macros that wrap freelog for more uniform and
> informative log messages from the AI code. I want some feedback on it. It
> is not optimal, since you can't add more varargs to it (tried some other
> variants but none worked well). It should have option to specify your own
> loglevel but that's secondary.
>
> Please suggest something better. We need something like this to get decent
> logging of the AI and find bugs.
> +#define LOG_BODYGUARD LOG_VERBOSE
> +#define LOG_UNIT LOG_VERBOSE
> +
> +#define UNIT_LOG(punit, msg) \
LOG_UNIT and UNIT_LOG are too easy to mix. Rename LOG_UNIT to
UNIT_LOG_LEVEL or similar.
> + freelog(LOG_UNIT, "%s's %s[%d] (%d,%d)->(%d,%d) " ##msg##,\
> + unit_owner(punit)->name, unit_type(punit)->name, \
> + punit->id, punit->x, punit->y, \
> + punit->goto_dest_x, punit->goto_dest_y);
> +
> +#define BODYGUARD_LOG(punit, msg) \
> +{ \
> + struct unit *pcharge = find_unit_by_id(punit->ai.charge); \
This may yield "unused variable warnings" or worst may always be
executed.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
The Software is not designed or licensed for use in on-line control
equipment in hazardous environments, such as operation of nuclear
facilities, aircraft navigation or control, or direct life support
machines.
-- Java Compiler Compiler Download and License Agreement
|
|