Produced by Araxis Merge on 10/26/2017 10:44:23 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Oct 27 02:44:23 2017 UTC | ||
| 2 | OSCIF_BMS_v2_iter 2_September_2017.zip\BMS_Cand\Source\Sources\BMS.Vista.TestEis\BMS.Utils | BmsLogger.cs | Wed Oct 18 18:47:02 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 311 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | using Syst em; | |||||
| 2 | using Syst em.Diagnos tics; | |||||
| 3 | using Syst em.Threadi ng; | |||||
| 4 | ||||||
| 5 | namespace BMS.Utils | |||||
| 6 | { | |||||
| 7 | /// <s ummary> | |||||
| 8 | /// Th e logger u sed to log messages to trace. | |||||
| 9 | /// </ summary> | |||||
| 10 | public class Bms Logger | |||||
| 11 | { | |||||
| 12 | pu blic enum Level { No ne, Error, Warning, Info, Verb ose } | |||||
| 13 | ||||||
| 14 | pr ivate Trac eSwitch _o bjSwitch = new Trace Switch("Tr aceLevelSw itch", "tr ace level" , "3"); | |||||
| 15 | ||||||
| 16 | pr ivate read only strin g appendIn fo; | |||||
| 17 | ||||||
| 18 | pu blic BmsLo gger(strin g appendIn fo) | |||||
| 19 | { | |||||
| 20 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 21 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 22 | { | |||||
| 23 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 24 | } | |||||
| 25 | try | |||||
| 26 | { | |||||
| 27 | this .appendInf o = append Info; | |||||
| 28 | } | |||||
| 29 | finally | |||||
| 30 | { | |||||
| 31 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 32 | { | |||||
| 33 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 34 | } | |||||
| 35 | } | |||||
| 36 | } | |||||
| 37 | ||||||
| 38 | pr ivate stri ng AppendI nfo(string message) | |||||
| 39 | { | |||||
| 40 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 41 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 42 | { | |||||
| 43 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 44 | } | |||||
| 45 | try | |||||
| 46 | { | |||||
| 47 | retu rn string. Format("\r \n{0}\r\n{ 1}{2}\r\n{ 3}", | |||||
| 48 | String.For mat(Tracer .START_LIN E, Thread. CurrentThr ead.Manage dThreadId, DateTime. Now), | |||||
| 49 | appendInfo , | |||||
| 50 | message, | |||||
| 51 | Tracer.END _LINE); | |||||
| 52 | } | |||||
| 53 | finally | |||||
| 54 | { | |||||
| 55 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 56 | { | |||||
| 57 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 58 | } | |||||
| 59 | } | |||||
| 60 | } | |||||
| 61 | ||||||
| 62 | // / <summary > | |||||
| 63 | // / Logs the specified message. | |||||
| 64 | // / </summar y> | |||||
| 65 | // / <param n ame="messa ge">The me ssage.</pa ram> | |||||
| 66 | pu blic void Log(string message) | |||||
| 67 | { | |||||
| 68 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 69 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 70 | { | |||||
| 71 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 72 | } | |||||
| 73 | try | |||||
| 74 | { | |||||
| 75 | Trac e.WriteLin e(AppendIn fo(message )); | |||||
| 76 | } | |||||
| 77 | finally | |||||
| 78 | { | |||||
| 79 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 80 | { | |||||
| 81 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 82 | } | |||||
| 83 | } | |||||
| 84 | } | |||||
| 85 | ||||||
| 86 | // / <summary > | |||||
| 87 | // / Logs the error. | |||||
| 88 | // / </summar y> | |||||
| 89 | // / <param n ame="messa ge">The me ssage.</pa ram> | |||||
| 90 | pu blic void LogError(S tring mess age) | |||||
| 91 | { | |||||
| 92 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 93 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 94 | { | |||||
| 95 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 96 | } | |||||
| 97 | try | |||||
| 98 | { | |||||
| 99 | if ( _objSwitch .TraceErro r) | |||||
| 100 | { | |||||
| 101 | Trace.Trac eError(App endInfo(me ssage)); | |||||
| 102 | } | |||||
| 103 | } | |||||
| 104 | finally | |||||
| 105 | { | |||||
| 106 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 107 | { | |||||
| 108 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 109 | } | |||||
| 110 | } | |||||
| 111 | } | |||||
| 112 | ||||||
| 113 | // / <summary > | |||||
| 114 | // / Logs the warning. | |||||
| 115 | // / </summar y> | |||||
| 116 | // / <param n ame="messa ge">The me ssage.</pa ram> | |||||
| 117 | pu blic void LogWarning (String me ssage) | |||||
| 118 | { | |||||
| 119 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 120 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 121 | { | |||||
| 122 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 123 | } | |||||
| 124 | try | |||||
| 125 | { | |||||
| 126 | if ( _objSwitch .TraceWarn ing) | |||||
| 127 | { | |||||
| 128 | Trace.Trac eWarning(A ppendInfo( message)); | |||||
| 129 | } | |||||
| 130 | } | |||||
| 131 | finally | |||||
| 132 | { | |||||
| 133 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 134 | { | |||||
| 135 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 136 | } | |||||
| 137 | } | |||||
| 138 | } | |||||
| 139 | ||||||
| 140 | // / <summary > | |||||
| 141 | // / Logs the informati on. | |||||
| 142 | // / </summar y> | |||||
| 143 | // / <param n ame="messa ge">The me ssage.</pa ram> | |||||
| 144 | pu blic void LogInforma tion(strin g message) | |||||
| 145 | { | |||||
| 146 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 147 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 148 | { | |||||
| 149 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 150 | } | |||||
| 151 | try | |||||
| 152 | { | |||||
| 153 | if ( _objSwitch .TraceInfo ) | |||||
| 154 | { | |||||
| 155 | Trace.Trac eInformati on(AppendI nfo(messag e)); | |||||
| 156 | } | |||||
| 157 | } | |||||
| 158 | finally | |||||
| 159 | { | |||||
| 160 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 161 | { | |||||
| 162 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 163 | } | |||||
| 164 | } | |||||
| 165 | } | |||||
| 166 | ||||||
| 167 | pu blic void LogVerbose (string me ssage) | |||||
| 168 | { | |||||
| 169 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 170 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 171 | { | |||||
| 172 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 173 | } | |||||
| 174 | try | |||||
| 175 | { | |||||
| 176 | Trac e.WriteLin eIf(_objSw itch.Trace Verbose, A ppendInfo( message), "Verbose") ; | |||||
| 177 | } | |||||
| 178 | finally | |||||
| 179 | { | |||||
| 180 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 181 | { | |||||
| 182 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 183 | } | |||||
| 184 | } | |||||
| 185 | } | |||||
| 186 | ||||||
| 187 | pu blic void LogFormat( Level leve l, string format, ob ject arg0) | |||||
| 188 | { | |||||
| 189 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 190 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 191 | { | |||||
| 192 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 193 | } | |||||
| 194 | try | |||||
| 195 | { | |||||
| 196 | LogF ormat(leve l, () => s tring.Form at(format, arg0)); | |||||
| 197 | } | |||||
| 198 | finally | |||||
| 199 | { | |||||
| 200 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 201 | { | |||||
| 202 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 203 | } | |||||
| 204 | } | |||||
| 205 | } | |||||
| 206 | ||||||
| 207 | pu blic void LogFormat( Level leve l, string format, ob ject arg0, object ar g1) | |||||
| 208 | { | |||||
| 209 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 210 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 211 | { | |||||
| 212 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 213 | } | |||||
| 214 | try | |||||
| 215 | { | |||||
| 216 | LogF ormat(leve l, () => s tring.Form at(format, arg0, arg 1)); | |||||
| 217 | } | |||||
| 218 | finally | |||||
| 219 | { | |||||
| 220 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 221 | { | |||||
| 222 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 223 | } | |||||
| 224 | } | |||||
| 225 | } | |||||
| 226 | ||||||
| 227 | pu blic void LogFormat( Level leve l, string format, ob ject arg0, object ar g1, object arg2) | |||||
| 228 | { | |||||
| 229 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 230 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 231 | { | |||||
| 232 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 233 | } | |||||
| 234 | try | |||||
| 235 | { | |||||
| 236 | LogF ormat(leve l, () => s tring.Form at(format, arg0, arg 1, arg2)); | |||||
| 237 | } | |||||
| 238 | finally | |||||
| 239 | { | |||||
| 240 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 241 | { | |||||
| 242 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 243 | } | |||||
| 244 | } | |||||
| 245 | } | |||||
| 246 | ||||||
| 247 | pu blic void LogFormat( Level leve l, string format, pa rams objec t[] args) | |||||
| 248 | { | |||||
| 249 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 250 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 251 | { | |||||
| 252 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 253 | } | |||||
| 254 | try | |||||
| 255 | { | |||||
| 256 | LogF ormat(leve l, () => s tring.Form at(format, args)); | |||||
| 257 | } | |||||
| 258 | finally | |||||
| 259 | { | |||||
| 260 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 261 | { | |||||
| 262 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 263 | } | |||||
| 264 | } | |||||
| 265 | } | |||||
| 266 | ||||||
| 267 | pr ivate void LogFormat (Level lev el, Func<s tring> msj Func) | |||||
| 268 | { | |||||
| 269 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 270 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 271 | { | |||||
| 272 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 273 | } | |||||
| 274 | try | |||||
| 275 | { | |||||
| 276 | swit ch (level) | |||||
| 277 | { | |||||
| 278 | case Level .None: | |||||
| 279 | Log(ms jFunc()); | |||||
| 280 | break; | |||||
| 281 | case Level .Warning: | |||||
| 282 | if (_o bjSwitch.T raceWarnin g) | |||||
| 283 | Tr ace.TraceW arning(App endInfo(ms jFunc())); | |||||
| 284 | break; | |||||
| 285 | case Level .Error: | |||||
| 286 | if (_o bjSwitch.T raceError) | |||||
| 287 | Tr ace.TraceE rror(Appen dInfo(msjF unc())); | |||||
| 288 | break; | |||||
| 289 | case Level .Info: | |||||
| 290 | if (_o bjSwitch.T raceInfo) | |||||
| 291 | Tr ace.TraceI nformation (AppendInf o(msjFunc( ))); | |||||
| 292 | break; | |||||
| 293 | case Level .Verbose: | |||||
| 294 | if (_o bjSwitch.T raceVerbos e) | |||||
| 295 | Tr ace.WriteL ine(Append Info(msjFu nc()), "Ve rbose"); | |||||
| 296 | break; | |||||
| 297 | } | |||||
| 298 | } | |||||
| 299 | finally | |||||
| 300 | { | |||||
| 301 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 302 | { | |||||
| 303 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 304 | } | |||||
| 305 | } | |||||
| 306 | } | |||||
| 307 | ||||||
| 308 | ||||||
| 309 | ||||||
| 310 | } | |||||
| 311 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.