public Profiler(IDebugContext debugContext, LogLevel logLevel, string name = null) { _debugContext = debugContext; _logLevel = logLevel; _name = name; _watch = Stopwatch.StartNew(); _debugContext.Log(logLevel, "Start: {0}", _name ?? String.Empty); }
public void Dispose() { _watch.Stop(); _debugContext.Log(_logLevel, "End: {0} - Execution time: {1} ms", _name ?? String.Empty, _watch.ElapsedMilliseconds); }