@@ -41,30 +41,39 @@ public static LoggerConfiguration TCPSink(
4141 this LoggerSinkConfiguration loggerConfiguration ,
4242 IPAddress ipAddress ,
4343 int port ,
44+ int ? writeTimeoutMs = null ,
45+ int ? disposeTimeoutMs = null ,
4446 ITextFormatter textFormatter = null ,
4547 LogEventLevel restrictedToMinimumLevel = LevelAlias . Minimum )
4648 {
47- var sink = new TCPSink ( ipAddress , port , textFormatter ?? new LogstashJsonFormatter ( ) ) ;
48- return loggerConfiguration . Sink ( sink , restrictedToMinimumLevel ) ;
49+ return TCPSink ( loggerConfiguration , $ "tcp://{ ipAddress } :{ port } ", writeTimeoutMs , disposeTimeoutMs , textFormatter , restrictedToMinimumLevel ) ;
4950 }
5051
5152 public static LoggerConfiguration TCPSink (
5253 this LoggerSinkConfiguration loggerConfiguration ,
5354 string host ,
5455 int port ,
56+ int ? writeTimeoutMs = null ,
57+ int ? disposeTimeoutMs = null ,
5558 ITextFormatter textFormatter = null ,
5659 LogEventLevel restrictedToMinimumLevel = LevelAlias . Minimum )
5760 {
58- return TCPSink ( loggerConfiguration , $ "{ host } :{ port } ", textFormatter , restrictedToMinimumLevel ) ;
61+ return TCPSink ( loggerConfiguration , $ "{ host } :{ port } ", writeTimeoutMs , disposeTimeoutMs , textFormatter , restrictedToMinimumLevel ) ;
5962 }
6063
6164 public static LoggerConfiguration TCPSink (
6265 this LoggerSinkConfiguration loggerConfiguration ,
6366 string uri ,
67+ int ? writeTimeoutMs = null ,
68+ int ? disposeTimeoutMs = null ,
6469 ITextFormatter textFormatter = null ,
6570 LogEventLevel restrictedToMinimumLevel = LevelAlias . Minimum )
6671 {
67- var sink = new TCPSink ( BuildUri ( uri ) , textFormatter ?? new LogstashJsonFormatter ( ) ) ;
72+ var socketWriter = new TcpSocketWriter (
73+ BuildUri ( uri ) ,
74+ writeTimeoutMs : writeTimeoutMs ,
75+ disposeTimeoutMs : disposeTimeoutMs ) ;
76+ var sink = new TCPSink ( socketWriter , textFormatter ?? new LogstashJsonFormatter ( ) ) ;
6877 return loggerConfiguration . Sink ( sink , restrictedToMinimumLevel ) ;
6978 }
7079
0 commit comments