Class MQTTSink
Provides serilog sink for publishing logs to MQTT broker.
Inheritance
System.Object
MQTTSink
Implements
Serilog.Core.ILogEventSink
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Serilog.Sinks
Assembly: Serilog.Sinks.MQTT.dll
Syntax
public class MQTTSink : ILogEventSink, IDisposable
Constructors
| Improve this Doc View SourceMQTTSink(IMqttClientOptions, String, MqttQualityOfServiceLevel, ITextFormatter)
Creates new instance of MQTTSink
Declaration
public MQTTSink(IMqttClientOptions clientOptions, string topic, MqttQualityOfServiceLevel qoS = MqttQualityOfServiceLevel.AtMostOnce, ITextFormatter formatter = null)
Parameters
Type | Name | Description |
---|---|---|
MQTTnet.Client.Options.IMqttClientOptions | clientOptions | MQTT client options |
System.String | topic | Topic under which the logs are to be published. |
MQTTnet.Protocol.MqttQualityOfServiceLevel | qoS | Quality of service level. MQTTnet.Protocol.MqttQualityOfServiceLevel |
Serilog.Formatting.ITextFormatter | formatter | Custom log formatter. |
Properties
| Improve this Doc View SourceFormatter
Declaration
ITextFormatter Formatter { }
Property Value
Type | Description |
---|---|
Serilog.Formatting.ITextFormatter |
MqttClient
Declaration
IMqttClient MqttClient { }
Property Value
Type | Description |
---|---|
MQTTnet.Client.IMqttClient |
MqttClientOptions
Declaration
IMqttClientOptions MqttClientOptions { }
Property Value
Type | Description |
---|---|
MQTTnet.Client.Options.IMqttClientOptions |
QoS
Declaration
public MqttQualityOfServiceLevel QoS { get; }
Property Value
Type | Description |
---|---|
MQTTnet.Protocol.MqttQualityOfServiceLevel |
Topic
Gets Topic
name under which the logs are published in this MQTT sink.
Declaration
public string Topic { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Emit(LogEvent)
Emits (publishes) the event to the configured MQTT broker.
Declaration
public async void Emit(LogEvent logEvent)
Parameters
Type | Name | Description |
---|---|---|
Serilog.Events.LogEvent | logEvent |
Implements
Serilog.Core.ILogEventSink
System.IDisposable