InstallContext.LogMessage(String) Metoda

Definice

Zapíše zprávu do konzoly a do souboru protokolu pro instalaci.

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

Zpráva, kterou chcete napsat.

Příklady

Tento příklad je výňatek z příkladu v přehledu InstallContext třídy.

Pomocí IsParameterTrue metody zjistí, jestli LogtoConsole byl parametr nastaven. Pokud yes, pak použije metodu LogMessage k zápisu stavových zpráv do souboru protokolu instalace a konzoly.

// 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" ))
{
   // 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

Poznámky

Instalační program může volat tuto metodu pro zápis průběhu nebo jiné informace o stavu do souboru protokolu. Pokud parametry příkazového řádku určují, že se má zobrazit uživatelské rozhraní, měl by instalační program kromě volání LogMessage metody zobrazit pole zpráv nebo provádět dotazy. Text zapsaný do souboru protokolu nebude uživatelem zobrazen, pokud se InstallUtil.exe nepoužívá ke spuštění instalace a v příkazovém řádku je zadána hodnota /LogToConsole= true.

Platí pro

Viz také