Serilog.Sinks.NamedPipe.Factories
2.0.0
See the version list below for details.
dotnet add package Serilog.Sinks.NamedPipe.Factories --version 2.0.0
NuGet\Install-Package Serilog.Sinks.NamedPipe.Factories -Version 2.0.0
<PackageReference Include="Serilog.Sinks.NamedPipe.Factories" Version="2.0.0" />
paket add Serilog.Sinks.NamedPipe.Factories --version 2.0.0
#r "nuget: Serilog.Sinks.NamedPipe.Factories, 2.0.0"
// Install Serilog.Sinks.NamedPipe.Factories as a Cake Addin #addin nuget:?package=Serilog.Sinks.NamedPipe.Factories&version=2.0.0 // Install Serilog.Sinks.NamedPipe.Factories as a Cake Tool #tool nuget:?package=Serilog.Sinks.NamedPipe.Factories&version=2.0.0
Serilog.Sinks.NamedPipe.Factories
Provides functionality for creating a factory that provides a pipe to read/write log events.
Getting started
You probably want to use this package together with the Serilog.Sinks.NamedPipe package or the Serilog.Sinks.NamedPipe.Reader package. Both include this one as a transitive dependency so you shouldn't need to install this separately.
Install the package from NuGet:
dotnet add package Serilog.Sinks.NamedPipe.Factories
Usage
This package provides a static NamedPipeFactories class with several methods for creating named-pipe factories:
Method | Description |
---|---|
NamedPipeFactories.CreateFactory(...) |
Creates a factory for custom configured pipes. You have complete control. |
NamedPipeFactories.DefaultClientFactory(...) |
Creates a factory for named-pipe clients using Byte transmission mode. |
NamedPipeFactories.DefaultServerFactory(...) |
Creates a factory for named-pipe servers using Byte transmission mode. |
NamedPipeFactories.DefaultMessageClientFactory(...) |
Creates a factory for named-pipe clients using Message transmission mode.<br/>This mode is only supported by Windows. |
NamedPipeFactories.DefaultMessageServerFactory(...) |
Creates a factory for named-pipe servers using Message transmission mode.<br/>This mode is only supported by Windows. |
See the examples below for how to use these methods and their parameters.
Examples
CreateFactory
Allows manually creating a custom factory that provides a connected PipeStream:
// This overload is useful if the getStream parameter can be synchronous. The connect parameter is always async.
var factory = NamedPipeFactories.CreateFactory(
getStream: () => new NamedPipeClientStream(".", "myCustomPipe", PipeDirection.Out, PipeOptions.Asynchronous),
connect: (pipe, cancellationToken) => pipe.ConnectAsync(cancellationToken)
);
// This overload is useful if the getStream parameter needs to do some asynchronous work. The connect parameter is always async.
var factory = NamedPipeFactories.CreateFactory(
getStream: async () => {
await DoSomeWorkAsync();
return new NamedPipeClientStream(".", "myCustomPipe", PipeDirection.Out, PipeOptions.Asynchronous);
},
connect: (pipe, cancellationToken) => pipe.ConnectAsync(cancellationToken)
);
The getStream
function delegate parameter must create/provide an instance of PipeStream.
The connect
function delegate parameter should connect the PipeStream to the other end of the pipe. It must not return
until the connection has opened or been cancelled. The cancellationToken
parameter is provided by the sink and will be
used for cancelling connection attempts. This function will be called when a new pipe is needed, including whenever the
pipe connection is broken and needs to be reconnected.
DefaultClientFactory
Creates a factory for named-pipe clients with some predefined defaults. Any NamedPipeClientStream it creates will be assumed to be: local, Asynchronous, and will use Byte transmission mode.
// This overload uses a pipe direction of PipeDirection.InOut by default
var factory = NamedPipeFactories.DefaultClientFactory("myDefaultByteStreamPipe");
// This overload explicitly overrides the pipe direction
var factory = NamedPipeFactories.DefaultClientFactory("myDefaultByteStreamPipe", PipeDirection.Out);
DefaultServerFactory
Creates a factory for named-pipe servers with some predefined defaults. Any NamedPipeServerStream it creates will be Asynchronous and will use Byte transmission mode.
// This overload uses a pipe direction of PipeDirection.InOut by default
var factory = NamedPipeFactories.DefaultServerFactory("myDefaultByteStreamPipe");
// This overload explicitly overrides the pipe direction
var factory = NamedPipeFactories.DefaultServerFactory("myDefaultByteStreamPipe", PipeDirection.In);
DefaultMessageClientFactory
Creates a factory for named-pipe clients with some predefined defaults. Any NamedPipeClientStream it creates will be assumed to be: local, asynchronous, InOut direction, and use Message transmission-mode.
Note: Message transmission mode is only supported on Windows.
var factory = NamedPipeFactories.DefaultMessageClientFactory("myDefaultMessageStreamPipe");
DefaultMessageServerFactory
Creates a factory for named-pipe servers with some predefined defaults. Any NamedPipeServerStream it creates will be assumed to be: asynchronous, InOut direction, and use Message transmission-mode.
Note: Message transmission mode is only supported on Windows.
var factory = NamedPipeFactories.DefaultMessageServerFactory("myDefaultMessageStreamPipe");
License
This library is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
.NETStandard 2.1
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Serilog.Sinks.NamedPipe.Factories:
Package | Downloads |
---|---|
Serilog.Sinks.NamedPipe
Serilog sink that writes log events to a named pipe. |
|
Serilog.Sinks.NamedPipe.Reader
A reader for Serilog log events written to a named pipe by the Serilog.Sinks.NamedPipe sink. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.0 | 163 | 12/18/2024 |
2.0.2-ci0003 | 125 | 12/18/2024 |
2.0.2-ci0002 | 120 | 12/18/2024 |
2.0.1 | 493 | 8/14/2023 |
2.0.1-ci0002 | 223 | 8/14/2023 |
2.0.0 | 242 | 8/14/2023 |
1.1.1-ci0016 | 224 | 8/14/2023 |
1.1.1-ci0015 | 220 | 8/4/2023 |
1.1.1-ci0014 | 229 | 8/4/2023 |
1.1.1-ci0010 | 244 | 8/1/2023 |
1.1.1-ci0009 | 229 | 8/1/2023 |