A thread-safe control to display log messages.

Namespace: Dapfor.Net.Diagnostics
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: (


public class LogViewer : UserControl
Visual Basic
Public Class LogViewer
	Inherits UserControl
Visual C++
public ref class LogViewer : public UserControl
type LogViewer =  
        inherit UserControl


Besides text messages, programmer can associate with data any object that can carry extended information. For example, it can be a price snapshot, quantity value of a product or a pointer to the product object. When a programmer analyzes a log file, he can not just review messages, but also vizw product characteristics that can be dynamically changed. There are several possibilities of object association:
  • Creating a hierarchical representation of associated object's properties and its values
  • Displaying a list of properties with its values in a popup tooltip
  • Transferring an object associated with message to the .Net Inspector for detailed viewing and editing
It is important to mention, that the logger enables detailed viewing of state of whole application or its most important parts at the logging time.

Memory consumption of the LogViewer is about 150-160 bytes per message. The maximum quantity of the lines in the grid can be limited via MaxRowCount = MAX_VALUE. If the MAX_VALUE is exceeded, older messages are not displayed.

Besides that, memory consumption depends on size and type of object that can be stored together with the log entry. On the average, for simple objects this size equals 30-40 bytes per message. From the practical point of view, when the number of rows is limited to 100,000, memory consumption should not exceed 60-100 MB per 1,000,000 messages.


 Copy imageCopy
public enum Way

public sealed class Quote
    private readonly long qty;
    private readonly decimal price;
    private readonly Way way;

    public Quote(long qty, decimal price, Way way)
        this.qty = qty;
        this.price = price;
        this.way = way;

    public long Qty
        get { return qty; }
    public decimal Price
        get { return price; }
    public Way Way
        get { return way; }

Logger.Info("Hey, I just got a new price", new Quote(31911, 41, Way.Buy));

Inheritance Hierarchy

See Also