Factor out _expandIncludes

Includes need to be expanded when logging exceptions also.
Fix small brain damage
TODO: We need to test exception logging
Augh pdb
Merge pull request #510 from plomino/jean-import-until-imported

Import until imported