Click or drag to resize

ToolStripItemTarget Class

Logs text to Windows.Forms.ToolStripItem.Text property control of specified Name.
Inheritance Hierarchy
SystemObject
  NLog.TargetsTarget
    NLog.TargetsTargetWithLayout
      NLog.Windows.FormsToolStripItemTarget

Namespace:  NLog.Windows.Forms
Assembly:  NLog.Windows.Forms (in NLog.Windows.Forms.dll) Version: 5.2.3+a6f5d4397ec11371a92ffd5b29f2da9844f01c95
Syntax
public sealed class ToolStripItemTarget : TargetWithLayout

The ToolStripItemTarget type exposes the following members.

Constructors
  NameDescription
Public methodToolStripItemTarget
Initializes a new instance of the ToolStripItemTarget class.
Top
Properties
  NameDescription
Public propertyFormName
Gets or sets the name of the Form on which the ToolStrip is located.
Public propertyItemName
Gets or sets the name of the ToolStripItem to which NLog will log write log text.
Public propertyLayout
Gets or sets the layout used to format log messages.
(Inherited from TargetWithLayout.)
Public propertyName
Gets or sets the name of the target.
(Inherited from Target.)
Public propertyToolStripName
Gets or sets the name of ToolStrip that contains the ToolStripItem to which NLog will log write log text.
Top
Methods
  NameDescription
Public methodDispose
Closes the target.
(Inherited from Target.)
Public methodFlush
Flush any pending log messages (in case of asynchronous targets).
(Inherited from Target.)
Public methodPrecalculateVolatileLayouts
Calls the Precalculate(LogEventInfo) on each volatile layout used by this target. This method won't prerender if all layouts in this target are thread-agnostic.
(Inherited from Target.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Target.)
Public methodWriteAsyncLogEvent
Writes the log to the target.
(Inherited from Target.)
Public methodWriteAsyncLogEvents(AsyncLogEventInfo)
Writes the array of log events.
(Inherited from Target.)
Public methodWriteAsyncLogEvents(IListAsyncLogEventInfo)
Writes the array of log events.
(Inherited from Target.)
Top
Examples

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

XML
1!ERROR: See log file!

The result is:

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

C#
1!ERROR: See log file!
,
See Also