Class Tracker
- Namespace
- Dynamicweb.Diagnostics.Tracking
- Assembly
- Dynamicweb.Diagnostics.dll
The Class Tracker represents tracker of log entries
public class Tracker : IDisposable
- Inheritance
-
Tracker
- Implements
- Inherited Members
Properties
LogFolder
Gets the log folder.
public DirectoryInfo LogFolder { get; }
Property Value
- DirectoryInfo
- The log folder.
Status
Gets related Status instance
public Status Status { get; }
Property Value
Methods
DeleteTrackerHistory(string)
Delete tracker history
public static void DeleteTrackerHistory(string subpath)
Parameters
subpath
string- The subpath under BaseFolder to delete. Format: {path1}\{path2\..\{pathN} will delete the folder {pathN} and all its contents.
Dispose()
Stops the tracker
public void Dispose()
Dispose(bool)
Stops the tracker
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
Fail(string, Exception)
Records a fail with given reason in logs and stops the tracker
public void Fail(string reason, Exception ex = null)
Parameters
GetStatusHistory(string)
Gets the 10 newest Status elements in the specified subpath. The list is sorted by date in descending order.
public static IEnumerable<Status> GetStatusHistory(string subpath)
Parameters
subpath
string- The subpath under BaseFolder to Status elements from. Format: {path1}\{path2}\...\{pathN} will get all Status elements in {pathN}.
Returns
- IEnumerable<Status>
- A list of Status elements
GetStatusHistory(string, int)
Gets the newest Status elements in the specified subpath. The list is sorted by date in descending order.
public static IEnumerable<Status> GetStatusHistory(string subpath, int count)
Parameters
subpath
string- The subpath under BaseFolder to Status elements from. Format: {path1}\{path2}\...\{pathN} will get all Status elements in {pathN}.
count
int- The number of Status elements to get.
Returns
- IEnumerable<Status>
- A list of Status elements
GetTracker(string)
Gets a Tracker ready to be used.
public static Tracker GetTracker(string subpath)
Parameters
subpath
string- The subpath under BaseFolder to store Status elements.
Returns
IncrementCounter()
Increses Status current count by 1
public void IncrementCounter()
IncrementCounter(int)
Increses Status current count by given increment
public void IncrementCounter(int incrementCount)
Parameters
LogException(string, Exception)
Logs and exception
public void LogException(string message, Exception ex = null)
Parameters
LogInformation(string, params object[])
Logs the information.
public void LogInformation(string message, params object[] args)
Parameters
Start()
Starts the tracker
public void Start()
Remarks
if not yet started - captures start time, otherwise does nothing
Stop()
Stops the tracker
public void Stop()
Remarks
if not yet stoped or still started - captures end time, otherwise does nothing