code optimization for eventlog capture