Creates a new instance of VGLogEntry
Namespace: Novalys.VisualGuard.Security.LoggingAssembly: Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2017.0.101.17 (2017.0.101.17)
Syntax
C# |
---|
public VGLogEntry( int eventId, string title, string message, TraceEventType severity, StringDictionary properties ) |
Visual Basic |
---|
Public Sub New ( eventId As Integer, title As String, message As String, severity As TraceEventType, properties As StringDictionary ) |
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.
- properties
- Type: System.Collections.Specialized..::..StringDictionary
Dictionary of key/value pairs that can be used as extended properties in the message.
Remarks
You can use predefined values in your message. 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.
- [p:XXX] - represents the property with the name 'XXX' stored in the specified dictionary.
Examples
C# | Copy |
---|---|
StringDictionary dictionary = new StringDictionary(); dictionary.Add("myparam", "text of my param"); VGLogEntry entry = new VGLogEntry("User Id:[userid]", "Application:[tab][applicationid][newline]My parameter:[tab][p:myparam][newline]Computer:[tab][machine]", TraceEventType.Information, dictionary); VGLogger.Write(entry); |
Visual Basic | Copy |
---|---|
Dim dictionary as StringDictionary = new StringDictionary() dictionary.Add("myparam", "text of my param") Dim entry as VGLogEntry entry = new VGLogEntry("User Id:[userid]", "Application:[tab][applicationid][newline]My parameter:[tab][p:myparam][newline]Computer:[tab][machine]", TraceEventType.Information, dictionary) VGLogger.Write(entry) |
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentOutOfRangeException | eventId is less than zero or greater than 9999. |