WebThreadInformation.FormatToString(WebEventFormatter) Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Форматирует сведения о потоке.
public:
void FormatToString(System::Web::Management::WebEventFormatter ^ formatter);
public void FormatToString (System.Web.Management.WebEventFormatter formatter);
member this.FormatToString : System.Web.Management.WebEventFormatter -> unit
Public Sub FormatToString (formatter As WebEventFormatter)
Параметры
- formatter
- WebEventFormatter
Объект WebEventFormatter, содержащий сведения о табуляции и отступах, используемые для форматирования сведений о веб-событиях работоспособности.
Примеры
В следующем примере кода показано, как форматировать пользовательские сведения.
// Formats Web request event information.
public override void FormatCustomEventDetails(
WebEventFormatter formatter)
{
// Add custom data.
formatter.AppendLine("");
formatter.AppendLine(
"Custom Thread Information:");
formatter.IndentationLevel += 1;
// Display the thread information obtained
formatter.AppendLine(GetThreadImpersonation());
formatter.AppendLine(GetThreadStackTrace());
formatter.AppendLine(GetThreadAccountName());
formatter.AppendLine(GetThreadId());
formatter.IndentationLevel -= 1;
formatter.AppendLine(eventInfo.ToString());
}
' Formats Web request event information.
Public Overrides Sub FormatCustomEventDetails( _
ByVal formatter As WebEventFormatter)
' Add custom data.
formatter.AppendLine("")
formatter.AppendLine( _
"Custom Thread Information:")
formatter.IndentationLevel += 1
' Display the thread information obtained
formatter.AppendLine(GetThreadImpersonation())
formatter.AppendLine(GetThreadStackTrace())
formatter.AppendLine(GetThreadAccountName())
formatter.AppendLine(GetThreadId())
formatter.IndentationLevel -= 1
formatter.AppendLine(eventInfo.ToString())
End Sub
Комментарии
Этот FormatToString метод предоставляет универсальный формат для сведений о событиях, что полезно, если данные события должны быть записаны в журнал, а затем представлены пользователю. Он вызывается внутренне, когда поставщик вызывает один из ToString методов.