Logging in the Code Base
Introduction
This section covers the 2 types of logging in the PCGen codebase.
Logging
There are currently two error reporting systems used in the loader system.
New Tokens
The first is the error reporting used in the "new tokens", which also requires the new loader structure. This uses addParseMessage along with the ability to replay messages. A good example can be traced through plugin.lsttokens.equipment.RangeToken and pcgen.persistence.lst.GenericLoader. However, since the Game Mode files aren't using the new loader structure, you can't use this system (at least not without a lot of [unnecessary] work). An important thing I found out with this system is that it is not suited to warnings as the messages generally only get output (replayed) if the token fails by returning false when parsed. In that case Logging.log(Logging.LST_WARN, "blah should be avoided"); is a better option.
Existing System
The second system is (also) in Logging, so if you need to output an error, all you need to do is call:
Logging.errorPrint("blah failed due to stuff");
...and then return false from the token. The AUTO subtokens (e.g. plugin.lsttokens.auto.ArmorProfToken.java) are places where this old messaging still exists in a token. This is the method you should use in the Game Mode files. The ideal is to use Logging.log(Logging.LST_ERROR, "blah failed due to stuff"); so that it correctly categorised on the output.