The Daily WTF
Tony sends us this snipped of C# code:
internal static bool TraceListner(ProjectInstance objPI, Exception objError, int EntityID, Enumerations.LogEntityType EntityType, int EntityInterfaceID, Enumerations.LogReturnType ReturnType, Enumerations.EventLevels EventLevel, string StartTime, string EndTime, int UserID, string Description) { ProcessAudit objLog; bool blnWrite; try { // WRITE THE TRACE LOG IF PROCESS HAS AUDIT FLAG = TRUE //AND THE CURRENT ACTIVTIY AUDIT FLAG = TRUE // need to log all of the errors regardless of the activity blnWrite = true; // write to the log if it is an error type log if (!(objError == null)) blnWrite = true; if (blnWrite == true) { objLog = new PrjectAudit(objPI, objError, EntityID, Convert.ToInt32(EntityType), EntityInterfaceID, Convert.ToInt32(EventLevel), StartTime, EndTime, Convert.ToInt32(ReturnType), Description, UserID); return objLog.Save(); } } catch { } return false; }
This code is helpfully commented to make the “logic” clearer. And also the history of how this code evolved. First, we wanted to only
To read the full article click on the 'post' link at the top.