EventLogEntryType Enumeración

Definición

Especifica el tipo de evento de una entrada del registro de eventos.Specifies the event type of an event log entry.

public enum class EventLogEntryType
public enum EventLogEntryType
type EventLogEntryType = 
Public Enum EventLogEntryType
Herencia
EventLogEntryType

Campos

Error 1

Evento de error.An error event. Indica un error importante que el usuario debe conocer; normalmente, se trata de una pérdida de funcionalidad o de datos.This indicates a significant problem the user should know about; usually a loss of functionality or data.

FailureAudit 16

Evento de auditoría incorrecta.A failure audit event. Indica un evento de seguridad que se produce cuando se genera un error de intento de acceso auditado; por ejemplo, cuando se genera un error al intentar abrir un archivo.This indicates a security event that occurs when an audited access attempt fails; for example, a failed attempt to open a file.

Information 4

Evento de información.An information event. Indica una operación significativa y correctamente realizada.This indicates a significant, successful operation.

SuccessAudit 8

Evento de auditoría correcta.A success audit event. Indica el evento de seguridad que se produce cuando hay un intento de acceso auditado correctamente realizado; por ejemplo, iniciar la sesión correctamente.This indicates a security event that occurs when an audited access attempt is successful; for example, logging on successfully.

Warning 2

Evento de advertencia.A warning event. Indica un problema que no es importante en ese momento, pero que puede indicar situaciones que podrían causar problemas en el futuro.This indicates a problem that is not immediately significant, but that may signify conditions that could cause future problems.

Ejemplos

En el ejemplo de código siguiente se muestra cómo EventLogEntryType utilizar la clase para agregar información acerca de los eventos desencadenados a un archivo de registro.The following code example demonstrates how to use the EventLogEntryType class to add information about triggered events to a log file. En este ejemplo, se switch usa una instrucción para determinar el tipo de evento.In this example, a switch statement is used to determine the event type. Cada case instrucciónEventLogEntryType utiliza para especificar el tipo de evento, obtiene el mensaje y el identificador y, a continuación, escribe la información en el registro.Each case statement uses the EventLogEntryType to specify the event type, gets the message and ID, and then writes the information to the log.

// Check whether source exist in event log.
if (  !EventLog::SourceExists( mySource ) )
{
   
   // Create a new source in a specified log on a system.
   EventLog::CreateEventSource( mySource, myLog );
}

// Create an event log instance.* myEventLog = new EventLog(myLog);
// Initialize source property of obtained instance.
myEventLog->Source = mySource;
switch ( myIntLog )
{
   case 1:
      
      // Write an 'Error' entry in specified log of event log.
      myEventLog->WriteEntry( myMessage, EventLogEntryType::Error, myID );
      break;

   case 2:
      
      // Write a 'Warning' entry in specified log of event log.
      myEventLog->WriteEntry( myMessage, EventLogEntryType::Warning, myID );
      break;

   case 3:
      
      // Write an 'Information' entry in specified log of event log.
      myEventLog->WriteEntry( myMessage, EventLogEntryType::Information, myID );
      break;

   case 4:
      
      // Write a 'FailureAudit' entry in specified log of event log.
      myEventLog->WriteEntry( myMessage, EventLogEntryType::FailureAudit, myID );
      break;

   case 5:
      
      // Write a 'SuccessAudit' entry in specified log of event log.
      myEventLog->WriteEntry( myMessage, EventLogEntryType::SuccessAudit, myID );
      break;

   default:
      Console::WriteLine( "Error: Failed to create an event in event log." );
      break;
}
Console::WriteLine( "A new event in log '{0}' with ID '{1}' is successfully written into event log.", myEventLog->Log, myID );


// Create an event log instance.
myEventLog = new EventLog(myLog);
// Initialize source property of obtained instance.
myEventLog.Source = mySource;
switch (myIntLog)
{
    case 1:
        // Write an 'Error' entry in specified log of event log.
        myEventLog.WriteEntry(myMessage, EventLogEntryType.Error, myID);
        break;
    case 2:
        // Write a 'Warning' entry in specified log of event log.
        myEventLog.WriteEntry(myMessage, EventLogEntryType.Warning, myID);
        break;
    case 3:
        // Write an 'Information' entry in specified log of event log.
        myEventLog.WriteEntry(myMessage, EventLogEntryType.Information, myID);
        break;
    case 4:
        // Write a 'FailureAudit' entry in specified log of event log.
        myEventLog.WriteEntry(myMessage, EventLogEntryType.FailureAudit, myID);
        break;
    case 5:
        // Write a 'SuccessAudit' entry in specified log of event log.
        myEventLog.WriteEntry(myMessage, EventLogEntryType.SuccessAudit, myID);
        break;
    default:
        Console.WriteLine("Error: Failed to create an event in event log.");
        break;
}
Console.WriteLine("A new event in log '{0}' with ID '{1}' "
   + "is successfully written into event log.",
   myEventLog.Log, myID);
' Check whether source exist in event log.
If False = EventLog.SourceExists(mySource) Then
   ' Create a new source in a specified log on a system.
   EventLog.CreateEventSource(mySource, myLog)
End If
' Create an event log instance.
myEventLog = New EventLog(myLog)
' Initialize source property of obtained instance.
myEventLog.Source = mySource
Select Case myIntLog
   Case 1
      ' Write an 'Error' entry in specified log of event log.
      myEventLog.WriteEntry(myMessage, EventLogEntryType.Error, myID)
   Case 2
      ' Write a 'Warning' entry in specified log of event log.
      myEventLog.WriteEntry(myMessage, EventLogEntryType.Warning, myID)
   Case 3
      ' Write an 'Information' entry in specified log of event log.
      myEventLog.WriteEntry(myMessage, EventLogEntryType.Information, myID)
   Case 4
      ' Write a 'FailureAudit' entry in specified log of event log.
      myEventLog.WriteEntry(myMessage, EventLogEntryType.FailureAudit, myID)
   Case 5
      ' Write a 'SuccessAudit' entry in specified log of event log.
      myEventLog.WriteEntry(myMessage, EventLogEntryType.SuccessAudit, myID)
   Case Else
      Console.WriteLine("Error: Failed to create an event in event log.")
End Select
Console.WriteLine("A new event in log '{0}' with ID '{1}' " + _
         "is successfully written into event log.", myEventLog.Log, myID)

Comentarios

El tipo de una entrada del registro de eventos proporciona información adicional para la entrada.The type of an event log entry provides additional information for the entry. Las aplicaciones establecen el tipo de entrada cuando escriben la entrada en el registro de eventos.Applications set the entry type when they write the entry to the event log.

Cada evento debe ser de un solo tipo; los tipos de evento no se pueden combinar para una entrada.Each event must be of a single type; the event types cannot be combined for an entry. El Visor de eventos usa este tipo para determinar qué icono se debe mostrar en la vista de lista del registro.The Event Viewer uses this type to determine which icon to display in the list view of the log.

Se aplica a

Consulte también: