tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
TopicClientFactory.cs
Go to the documentation of this file.
1using System;
2
3using Byond.TopicSender;
4
5using Microsoft.Extensions.Logging;
6
8{
11 {
15 readonly ILogger<TopicClient>? logger;
16
21 public TopicClientFactory(ILogger<TopicClient> logger)
22 {
23 ArgumentNullException.ThrowIfNull(logger);
24
25 // Don't want the debug logs Topic client spits out either, they're too verbose
26 if (logger.IsEnabled(LogLevel.Trace))
27 this.logger = logger;
28 }
29
31 public ITopicClient CreateTopicClient(TimeSpan timeout)
32 => new TopicClient(
33 new SocketParameters
34 {
35 ConnectTimeout = timeout,
36 DisconnectTimeout = timeout,
37 ReceiveTimeout = timeout,
38 SendTimeout = timeout,
39 },
40 logger);
41 }
42}
TopicClientFactory(ILogger< TopicClient > logger)
Initializes a new instance of the TopicClientFactory class.
ITopicClient CreateTopicClient(TimeSpan timeout)
Create a ITopicClient.A new ITopicClient.
readonly? ILogger< TopicClient > logger
The ILogger for created ITopicClients.