NLog.Windows.Forms Strings rendered with this rendrer would convert to links in the control. Internally this renderer replaces the rendered text with a GUID and stores the info in by as a key Actual rendering is done in Implementation of a Inner layout that actually provides text Inernal class storing the captured link info, used by to convert the text to link and then identify the logEvent Used as a key in Highlighting rule for Win32 colorful console. Initializes a new instance of the class. Initializes a new instance of the class. The text to be matched..Color of the text.Color of the background. Initializes a new instance of the class. The text to be matched..Color of the text.Color of the background.The font style. Gets or sets the regular expression to be matched. You must specify either text or regex. Gets or sets the text to be matched. You must specify either text or regex. Gets or sets a value indicating whether to match whole words only. Gets or sets a value indicating whether to ignore case when comparing texts. Gets or sets the font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing. Gets the compiled regular expression that matches either Text or Regex property. Gets or sets the font color. Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed. Gets or sets the background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. The row-coloring condition. Initializes static members of the RichTextBoxRowColoringRule class. Initializes a new instance of the class. Initializes a new instance of the class. The condition.Color of the foreground text.Color of the background text.The font style. Initializes a new instance of the class. The condition.Color of the text.Color of the background. Checks whether the specified log event matches the condition (if any). Log event. A value of if the condition is not defined or if it matches, otherwise. Gets the default highlighting rule. Doesn't change the color. Gets or sets the condition that must be met in order to set the specified font color. Gets or sets the font color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. Gets or sets the background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. Gets or sets the font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing Logs text to Windows.Forms.Control.Text property control of specified Name.

To set up the target in the configuration file, use the following syntax:

The result is:

To set up the log target programmatically similar to above use code like this:

,
Initializes a new instance of the class. The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} Log message to control. The logging event. Gets or sets the name of control to which NLog will log write log text. Gets or sets a value indicating whether log text should be appended to the text of the control instead of overwriting it. Gets or sets the name of the Form on which the control is located. Gets or sets whether new log entry are added to the start or the end of the control Form helper methods. Creates RichTextBox and docks in parentForm. Name of RichTextBox. Form to dock RichTextBox. Created RichTextBox. Finds control embedded on searchControl. Name of the control. Control in which we're searching for control. A value of null if no control has been found. Finds control of specified type embended on searchControl. The type of the control. Name of the control. Control in which we're searching for control. A value of null if no control has been found. Creates a form. Name of form. Width of form. Height of form. Auto show form. If set to true the form will be minimized. If set to true the form will be created as tool window. Created form. Replaces currently selected text in the RTB control with a link target control visible text of the new link hidden part of the new link Based on http://www.codeproject.com/info/cpol10.aspx Sets selection style for RichTextBox https://msdn.microsoft.com/en-us/library/windows/desktop/bb787883(v=vs.85).aspx target control Specifies the parts of the CHARFORMAT2 structure that contain valid information. A set of bit flags that specify character effects. Based on http://www.codeproject.com/info/cpol10.aspx CHARFORMAT2 structure, contains information about character formatting in a rich edit control. see https://msdn.microsoft.com/en-us/library/windows/desktop/bb787883(v=vs.85).aspx Pops up log messages as message boxes. Documentation on NLog Wiki

To set up the target in the configuration file, use the following syntax:

This assumes just one target and a single rule. More configuration options are described here.

The result is a message box:

To set up the log target programmatically use code like this:

Initializes a new instance of the class. The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} Displays the message box with the log message and caption specified in the Caption parameter. The logging event. Displays the message box with the array of rendered logs messages and caption specified in the Caption parameter. The array of logging events. Gets or sets the message box title. Log text a Rich Text Box control in an existing or new form. Documentation on NLog Wiki

To set up the target in the configuration file, use the following syntax:

The result is:

To set up the target with coloring rules in the configuration file, use the following syntax:

The result is:

To set up the log target programmatically similar to above use code like this:

, for RowColoring, for WordColoring
Internal prefix that is added to the link id in RTF Initializes static members of the RichTextBoxTarget class. The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} Attempts to attach existing targets that have yet no textboxes to controls that exist on specified form if appropriate Setting to true (default) actually causes target to always have a textbox (after having called), so such targets are not affected by this method. a Form to check for RichTextBoxes Returns a target attached to a given RichTextBox control a RichTextBox control for which the target is to be returned A RichTextBoxTarget attached to a given control or null if no target is attached Initializes a new instance of the class. The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} Actual value of the . A textbox to which we have logged last time. Used to prevent duplicating messages in the same textbox in case of config reload and RichTextBoxTargetMessageRetentionStrategy.All see https://github.com/NLog/NLog.Windows.Forms/pull/22 a lock object used to synchronize access to A queue used to store messages based on . Actual value of the property Lock for dictionary access A map from link id to a corresponding log event Used to synchronize lazy initialization of and in .set Used to capture link placeholders in Lazily initialized in .set(true). Assure checking before accessing the field Used to parse RTF with links when removing excess lines in Lazily initialized in .set(true). Assure checking before accessing the field Initializes the target. Can be used by inheriting classes to initialize logging. Called from constructor when error is detected. In case LogManager.ThrowExceptions is enabled, throws the exception, otherwise - logs the problem message exception/log message format message format arguments Used to create accessory form with textbox in case specified form or control were not found during InitializeTarget() and AllowAccessoryFormCreation==true Used to (re)initialize target when attaching it to another RTB control form owning textboxControl a new control to attach to Attached to RTB-control's LinkClicked event to convert link text to logEvent if is true, then destroys created form. Resets , and to default values Closes the target and releases any unmanaged resources. Log message to RichTextBox. The logging event. Actually sends log message to a message to send matching coloring rule original logEvent true if the message was actually sent (i.e. is not null and not disposed, and no exception happened during message send) Find first matching rule Stores a new message in internal queue, if it exists. Removes overflowing messages. a message to store a corresponding coloring rule original LogEvent Gets the default set of row coloring rules which applies when is set to true. Gets or sets the Name of RichTextBox to which Nlog will write. Gets or sets the name of the Form on which the control is located. If there is no open form of a specified name than NLog will create a new one. Gets or sets a value indicating whether to use default coloring rules. Gets the row coloring rules. Gets the word highlighting rules. Gets or sets a value indicating whether the created window will be a tool window. This parameter is ignored when logging to existing form control. Tool windows have thin border, and do not show up in the task bar. Gets or sets a value indicating whether the created form will be initially minimized. This parameter is ignored when logging to existing form control. Gets or sets the initial width of the form with rich text box. This parameter is ignored when logging to existing form control. Gets or sets the initial height of the form with rich text box. This parameter is ignored when logging to existing form control. Gets or sets a value indicating whether scroll bar will be moved automatically to show most recent log entries. Gets or sets the maximum number of lines the rich text box will store (or 0 to disable this feature). After exceeding the maximum number, first line will be deleted. Gets or sets the form to log to. Gets or sets the rich text box to log to. Form created (true) or used an existing (false). Set after . Can be true only if is set to true (default). Gets or sets a value indicating whether to create accessory form if the specified form/control combination was not found during target initialization. If set to false and the control was not found during target initialiation, the target would skip events until the control is found during call gets or sets the message retention strategy which determines how the target handles messages when there's no control attached, or when switching between controls If set to true, using "rtb-link" renderer () would create clickable links in the control. Event fired when the user clicks on a link in the control created by the "rtb-link" renderer (). Returns number of events stored for active links in the control. Used only in tests to check that non needed events are removed. Type of delegate for event. The target that caused the event Visible text of the link being clicked Original log event that caused a line with the link How to handle messages when switching between target controls or no control is attached at all Just skip logging events when no target control attached. Only new messages would be sent to rich text box after attachement. No additional resources spent on this. Store logging events only during periods when no target control attached. Only these messages would be sent to rich text box after attachment. Messages that were sent to previous textbox are not stored and would not be shown. Number of events stored is limited by . Store all events in internal queue. After attaching to a new control all the stored messages would be repeated in it, including messages that were sent to previous textbox. Number of messages stored is limited by .