-
Notifications
You must be signed in to change notification settings - Fork 0
Log filtering using Memory.debugTrace
global.trace(category, entityWhere, ...message)
global.logError(message, entityWhere)
These methods provide a powerful log filtering mechanism which can help you debug and triage what is happening with your Screeps colony.
First, make sure that your viral.parameter.js has the following entries:
DEBUG: true,
TRACE: true,
Next, setting trace on an individual creep is a convenience method to enable tracing of that creepName: Game.creeps[<creep name>].trace = true
This is identical to the command Memory.debugTrace.creepName = <creep name>
The result is that all debug traces which indicate that creep will be displayed.
TODO SCREENSHOT
Example: if( DEBUG && TRACE ) trace('Creep', {creepName:this.name, Behaviour: behaviour && behaviour.name, Creep:'run'}, 'behaviour selected');
Arguments:
- category -
'Creep'
identifies the broad category of event. It will be displayed first in the logs. - entityWhere -
{creepName:this.name, Behaviour: ...
identifies all the components and game entities connected to this trace. SettingMemory.debugTrace.<key> = <value>
will narrow down the selection to include matching events and exclude others. - message -
'behaviour selected'
additional information printed before the contents of entityWhere.
TODO MORE DETAIL
TODO just like adding a trace, but is displayed when the category 'error'
is shown (which it is by default).
TODO DETAILS