Table of Contents

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

Status

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

reason string
The reason of fail
ex Exception
The exception

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

Tracker
A ready to use Tracker.

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

incrementCount int
The increment count to be applied to Status count

LogException(string, Exception)

Logs and exception
public void LogException(string message, Exception ex = null)

Parameters

message string
The message to be recorded into logs
ex Exception
The exception

LogInformation(string, params object[])

Logs the information.
public void LogInformation(string message, params object[] args)

Parameters

message string
The message.
args object[]
The arguments.

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
To top