Creates a new instance of VGLogEntry

Namespace: Novalys.VisualGuard.Security.Logging
Assembly: Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2016.0.105.16 (2016.0.105.16)

Syntax

C#
public VGLogEntry(
	int eventId,
	string title,
	string message,
	TraceEventType severity,
	params Object[] unnamedProperties
)
Visual Basic
Public Sub New ( 
	eventId As Integer,
	title As String,
	message As String,
	severity As TraceEventType,
	ParamArray unnamedProperties As Object()
)

Parameters

eventId
Type: System..::..Int32
the event identifier (>= 0 and < 10000)
title
Type: System..::..String
the title of the message.
message
Type: System..::..String
the message body to log
severity
Type: System.Diagnostics..::..TraceEventType
Log entry severity as a Severity enumeration.
unnamedProperties
Type: array<System..::..Object>[]()[][]
An Object array containing zero or more objects to format.

Remarks

You can use predefined values or the specified unnamed properties in the body or the title of the message. If you want to use unnamed properties in your message, you just have to specified a format item like in Format(String, Object) method.

The list of predefined values is:

  • [eventid] - The unique identifier of log entry.
  • [applicationid] - The unique identifier of the application for which the log entry was generated.
  • [userid] - The repository id of the current user.
  • [username] - The name of the current user.
  • [timestamp] - Date and time of the log entry message.
  • [machine] - The Name of the computer.
  • [severity] - Log entry severity as a TraceEventType enumeration
  • [tab] - Insert a tab character in the body of a message.
  • [newline] - Insert a newline character in the body of a message.

If you want to use unnamed properties in the body or in the title of your message, you can use the same syntax as the Format(String, Object) method. Each format item will be replaced (e.g: {0}) with the equivalent text of the value of a corresponding object specified in the unnamedProperties array.

Examples

C# Copy imageCopy
VGLogEntry entry = new VGLogEntry("User Id:[userid]", "Application:[tab][applicationid][newline]My first value:[tab]{0}[newline]My second value:[tab]{1}[newline]Computer:[tab][machine]", TraceEventType.Information, 'MyValue1', true);
VGLogger.Write(entry);
Visual Basic Copy imageCopy
Dim entry as VGLogEntry = new VGLogEntry("User Id:[userid]", "Application:[tab][applicationid][newline]My first value:[tab]{0}[newline]My second value:[tab]{1}[newline]Computer:[tab][machine]", TraceEventType.Information, 'MyValue1', true)
VGLogger.Write(entry)
This example writes the following message in the event log:
            Application: {759b324a-a659-4777-8c5a-5464f2b1c50c}
            My First Value: MyValue1
            My Second Value: true
            Computer:   MYMACHINENAME
            

Exceptions

ExceptionCondition
System..::..ArgumentOutOfRangeExceptioneventId is less than zero or greater than 9999.

See Also