Factor out _expandIncludes

Includes need to be expanded when logging exceptions also.