LoggingChannel 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示記錄訊息的來源。
public ref class LoggingChannel sealed : IClosable
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingChannelFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingChannelFactory2, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class LoggingChannel final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingChannelFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingChannelFactory2, 65536, "Windows.Foundation.UniversalApiContract")]
class LoggingChannel final : IClosable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingChannelFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingChannelFactory2), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class LoggingChannel : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingChannelFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingChannelFactory2), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class LoggingChannel : System.IDisposable
function LoggingChannel(name, options, id)
Public NotInheritable Class LoggingChannel
Implements IDisposable
- 繼承
- 屬性
- 實作
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
備註
預設 LoggingLevel 為 Verbose。
將 LoggingChannel 實例新增至 LoggingSession 或 FileLoggingSession ,以在應用程式中啟用記錄。
LogMessage方法提供記錄簡單字串訊息的方式,而 LogEvent方法則提供記錄更複雜的追蹤資料的方法。
Windows 10現在支援兩種作業模式:Windows 8.1相容性模式和Windows 10和更新版本支援的新行為,可讓您記錄 Windows (ETW) 事件自我描述的事件追蹤,而不需要資訊清單。 + 針對Windows 8.1相容性模式,請使用LoggingChannel (String) 建構函式建立物件。
- 如需Windows 10和更新版本的特定行為,請使用LoggingChannel (String、LoggingChannelOptions) 或LoggingChannel (String、LoggingChannelOptions、Guid) 建構函式來建立 物件。 這兩種模式之間的差異如下:
Windows 8.1相容性模式 | Windows 10和更新版本的特定行為 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
某些 **LoggingChannel** 事件可能會參考 4bd2826e-54a1-4ba9-bf63-92b73ea1ac4a,也就是 [GUID] (/windows/win32/api/guiddef/ns-guiddef-guid) ,適用于Windows 8.1或更新版本的 **Microsoft-Windows-Diagnostics-LoggingChannel** 資訊清單。 | 所有事件都是自我描述的。 不需要任何資訊清單。 | |||||||||||||||
此
建構函式
屬性
方法事件
適用於另請參閱 |