Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2004:
[freeciv-ai] (PR#9659) RfP: Even better AI logging

[freeciv-ai] (PR#9659) RfP: Even better AI logging

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#9659) RfP: Even better AI logging
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Tue, 10 Aug 2004 03:21:12 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: >

The life of an AI debugger (even if it means just a couple of people)
was made much easier by introduction of specialized log calls like
CITY_LOG and UNIT_LOG and then by introduction of the "debug" command.

But the number of log calls grows and now comes the time that even
switching on the logging of one city can produce more output that you'd
want to see.  So we need more filtering.

BTW, the first argument to *_LOG calls, the loglevel, is almost useless
because all calls are debug ones so it is always LOG_DEBUG.

Here are two (mutually exclusive) proposals:

1. Introduce the "priority level", as in 
CITY_LOG(priority, pcity, message....)

priorities are
  provide outline of the program flow
  provide some detail
  for messages you probably will never want to see

then "debug" command has to be modified to be
  debug <max_pl> city <x> <y>
etc, which switches all log messages of priority max_pl and below for
this city

In addition, there are special priorities:
  should only be used temporarily to see this particular message,
  it should not be present in committed code
  will switch on this message for all cities, i.e. doesn't require a 
  debug command; should only be used when developing

2. Introduce "log group", as in 
CITY_LOG(group, pcity, message....)

The "debug" command becomes
  debug 2,5,6 city 13 32
which switches log messages of groups 2, 5 and 6 for city at (13,32).

Groups 0 and 99 are reserved and play the role of PL_FORCE and
PL_SPECIAL correspondingly.

In the code, the symbolic names of the groups should contain their
number as well, so you don't have to look up their value; for example
#define LG_MIL_BUILD3 3

Comments, opinions, code?

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#9659) RfP: Even better AI logging, Gregory Berkolaiko <=