Click or drag to resize

VGLogEntry Constructor (Int32, String, String, TraceEventType, Object)

Creates a new instance of VGLogEntry

Namespace:  Novalys.VisualGuard.Security.Logging
Assembly:  Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2019.1.831.19 (2019.1.0831.19)
Syntax
public VGLogEntry(
	int eventId,
	string title,
	string message,
	TraceEventType severity,
	params Object[] unnamedProperties
)

Parameters

eventId
Type: SystemInt32
the event identifier (>= 0 and < 10000)
title
Type: SystemString
the title of the message.
message
Type: SystemString
the message body to log
severity
Type: System.DiagnosticsTraceEventType
Log entry severity as a Severity enumeration.
unnamedProperties
Type: SystemObject
An Object array containing zero or more objects to format.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptioneventId is less than zero or greater than 9999.
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
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);
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
            
See Also