Udostępnij za pośrednictwem


InstallContext.LogMessage(String) Metoda

Definicja

Zapisuje komunikat w konsoli programu i do pliku dziennika instalacji.

public:
 void LogMessage(System::String ^ message);
public void LogMessage (string message);
member this.LogMessage : string -> unit
Public Sub LogMessage (message As String)

Parametry

message
String

Wiadomość do zapisu.

Przykłady

Ten przykład jest fragmentem przykładu w przeglądu InstallContext klasy klasy.

Używa IsParameterTrue metody , aby dowiedzieć się, czy LogtoConsole parametr został ustawiony. Jeśli yesparametr , użyje LogMessage metody do zapisywania komunikatów o stanie w pliku dziennika instalacji i konsoli programu .

// Check whether the "LogtoConsole" parameter has been set.
if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext->LogMessage( "The 'Install' method has been called" );
}
// Check whether the "LogtoConsole" parameter has been set.
if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage( "The 'Install' method has been called" );
}
' Check wether the "LogtoConsole" parameter has been set.
If myInstallContext.IsParameterTrue("LogtoConsole") = True Then
   ' Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage("The 'Install' method has been called")
End If

Uwagi

Instalator może wywołać tę metodę w celu zapisania postępu lub innych informacji o stanie do pliku dziennika. Jeśli parametry wiersza polecenia określają, że powinien być wyświetlany interfejs użytkownika, instalator powinien wyświetlać pola komunikatów lub wykonywać zapytania oprócz wywoływania LogMessage metody. Tekst zapisany w pliku dziennika nie będzie widoczny przez użytkownika, chyba że InstallUtil.exe jest używany do uruchamiania instalacji, a parametr "/LogToConsole= true" jest określony w wierszu polecenia.

Dotyczy

Zobacz też