Skip to content

Commit febaa55

Browse files
committed
Code comments, readme, and docs updates
1 parent ea0cd02 commit febaa55

File tree

10 files changed

+100
-5
lines changed

10 files changed

+100
-5
lines changed

Diff for: README.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
# MsBuildPipeLogger
2-
31
A logger for MSBuild that sends event data over anonymous or named pipes.
42

3+
**NuGet**
4+
* [MsBuildPipeLogger.Logger](https://www.nuget.org/packages/MsBuildPipeLogger.Logger/)
5+
* [MsBuildPipeLogger.Server](https://www.nuget.org/packages/MsBuildPipeLogger.Server/)
6+
7+
**MyGet**
8+
* [MsBuildPipeLogger.Logger](https://www.myget.org/feed/msbuildpipelogger/package/nuget/MsBuildPipeLogger.Logger)
9+
* [MsBuildPipeLogger.Server](https://www.myget.org/feed/msbuildpipelogger/package/nuget/MsBuildPipeLogger.Server)
10+
11+
**GitHub**
12+
* [MsBuildPipeLogger](https://github.com/daveaglick/MsBuildPipeLogger)
13+
14+
**Donations**
15+
16+
<a href="https://www.buymeacoffee.com/daveaglick"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
17+
18+
---
19+
520
## Say what?
621

722
As a general purpose build tool, MSBuild is really powerful. However, it can be hard to figure out what's going on under the hood. Thankfully, MSBuild provides a nice logging API that consists of sending a sequence of events to one or more attached loggers. This allows the logger to track (almost) everything that happens during the build.
@@ -14,6 +29,10 @@ I wrote this to address a need I had in [Buildalyzer](https://github.com/daveagl
1429

1530
## How do I use it?
1631

32+
There are two libraries:
33+
* [MsBuildPipeLogger.Logger](https://www.nuget.org/packages/MsBuildPipeLogger.Logger/) - the logger that's given to MSBuild.
34+
* [MsBuildPipeLogger.Server](https://www.nuget.org/packages/MsBuildPipeLogger.Server/) - the server that receives logging events from the pipe and raises them to your code.
35+
1736
Usage consists of creating a server to receive logging events and then telling MSBuild to use the `MsBuildPipeLogger`. It's slightly different depending on if you want to use an [anonymous pipe](https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-use-anonymous-pipes-for-local-interprocess-communication) or a [named pipe](https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-use-named-pipes-for-network-interprocess-communication).
1837

1938
### Anonymous pipe
@@ -85,5 +104,7 @@ The `MsBuildPipeLogger.Logger` recognizes these parameters, separated by a `;` a
85104
* `name` indicates the named pipe name: `MsBuildPipeLogger.Logger,MsBuildPipeLogger.Logger.dll;name=Mario`
86105
* `server` indicates the named pipe server (assumed to be a local pipe if omitted): `MsBuildPipeLogger.Logger,MsBuildPipeLogger.Logger.dll;name=Mario;server=MyServerName`
87106

88-
---
89-
This project is maintained by Dave Glick ([@daveaglick](https://github.com/daveaglick))
107+
### A note on concurrency
108+
109+
The `AnonymousPipeLoggerServer.Read()` and `NamedPipeLoggerServer.Read()` methods both block while waiting for additional events. If you need to support concurrency or cancellation, you'll need to wrap this call however is appropriate for your application.
110+

Diff for: docs/input/_Footer.cshtml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MsBuildPipeLogger is crafted by <a href="https://daveaglick.com">Dave Glick</a>. <a href="https://github.com/daveaglick/MsBuildPipeLogger">Code on GitHub</a>. Generated by <a href="https://wyam.io">Wyam</a> and hosted by <a href="https://www.netlify.com">Netlify</a> on a free open source plan.

Diff for: docs/input/_Navbar.cshtml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<li><a href="@(Context.GetLink("api"))">API</a></li>
2+
<li><a href="https://github.com/daveaglick/MsBuildPipeLogger">GitHub</a></li>
3+
<li class="buymeacoffee"><a href="https://www.buymeacoffee.com/daveaglick"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee"></a></li>

Diff for: docs/input/assets/css/override.less

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import "bootstrap/variables.less";
2+
@import "bootstrap/mixins.less";
3+
@import "adminlte/variables.less";
4+
@import "adminlte/mixins.less";
5+
6+
@media (min-width: 768px) {
7+
.buymeacoffee {
8+
position: absolute !important;
9+
right: 0 !important;
10+
top: -8px !important;
11+
12+
& a {
13+
height: 58px !important;
14+
15+
& img {
16+
height: auto !important;
17+
width: auto !important;
18+
}
19+
}
20+
}
21+
}

Diff for: docs/input/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
Title: MsBuildPipeLogger
1+
Title: Home
2+
NoTitle: true
23
---
34
^"../../README.md"

Diff for: src/MsBuildPipeLogger.Logger/MsBuildPipeLogger.Logger.csproj

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard1.3</TargetFrameworks>
55
<RootNamespace>MsBuildPipeLogger</RootNamespace>
6+
<Authors>Dave Glick</Authors>
7+
<Company>Dave Glick</Company>
8+
<Product />
9+
<Description>A logger for MSBuild that sends event data over anonymous or named pipes.</Description>
10+
<PackageProjectUrl>https://msbuildpipelogger.netlify.com/</PackageProjectUrl>
11+
<RepositoryUrl>https://github.com/daveaglick/MsBuildPipeLogger.git</RepositoryUrl>
12+
<PackageLicenseUrl>https://github.com/daveaglick/MsBuildPipeLogger/blob/master/LICENSE</PackageLicenseUrl>
613
</PropertyGroup>
714
<ItemGroup>
815
<PackageReference Include="Microsoft.Build" Version="14.3.0" PrivateAssets="All" />

Diff for: src/MsBuildPipeLogger.Server/AnonymousPipeLoggerServer.cs

+12
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@
33

44
namespace MsBuildPipeLogger
55
{
6+
/// <summary>
7+
/// An server for receiving MSBuild logging events over an anonymous pipe.
8+
/// </summary>
69
public class AnonymousPipeLoggerServer : PipeLoggerServer
710
{
811
private string _clientHandle;
912

13+
/// <summary>
14+
/// Creates an anonymous pipe server for receiving MSBuild logging events.
15+
/// </summary>
1016
public AnonymousPipeLoggerServer()
1117
: base(new AnonymousPipeServerStream(PipeDirection.In, HandleInheritability.Inheritable))
1218
{
1319
}
1420

21+
/// <summary>
22+
/// Gets the client handle as a string. The local copy of the handle will be automatically disposed
23+
/// on the first call to <see cref="Read"/>.
24+
/// </summary>
25+
/// <returns>The client handle as a string.</returns>
1526
public string GetClientHandle() =>
1627
_clientHandle ?? (_clientHandle = ((AnonymousPipeServerStream)PipeStream).GetClientHandleAsString());
1728

29+
/// <inheritdoc/>
1830
public override bool Read()
1931
{
2032
// First dispose the client handle if we asked for one

Diff for: src/MsBuildPipeLogger.Server/MsBuildPipeLogger.Server.csproj

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard1.5</TargetFramework>
55
<RootNamespace>MsBuildPipeLogger</RootNamespace>
6+
<Authors>Dave Glick</Authors>
7+
<Company>Dave Glick</Company>
8+
<Product />
9+
<Description>A logger for MSBuild that sends event data over anonymous or named pipes.</Description>
10+
<PackageProjectUrl>https://msbuildpipelogger.netlify.com/</PackageProjectUrl>
11+
<RepositoryUrl>https://github.com/daveaglick/MsBuildPipeLogger.git</RepositoryUrl>
12+
<PackageLicenseUrl>https://github.com/daveaglick/MsBuildPipeLogger/blob/master/LICENSE</PackageLicenseUrl>
613
</PropertyGroup>
714
<ItemGroup>
815
<PackageReference Include="Microsoft.Build" Version="15.3.409" />

Diff for: src/MsBuildPipeLogger.Server/NamedPipeLoggerServer.cs

+8
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22

33
namespace MsBuildPipeLogger
44
{
5+
/// <summary>
6+
/// An server for receiving MSBuild logging events over a named pipe.
7+
/// </summary>
58
public class NamedPipeLoggerServer : PipeLoggerServer
69
{
710
private bool _connected;
811

12+
/// <summary>
13+
/// Creates a named pipe server for receiving MSBuild logging events.
14+
/// </summary>
15+
/// <param name="pipeName">The name of the pipe to create.</param>
916
public NamedPipeLoggerServer(string pipeName)
1017
: base(new NamedPipeServerStream(pipeName, PipeDirection.In))
1118
{
1219
}
1320

21+
/// <inheritdoc />
1422
public override bool Read()
1523
{
1624
if (!_connected)

Diff for: src/MsBuildPipeLogger.Server/PipeLoggerServer.cs

+14
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
namespace MsBuildPipeLogger
1111
{
12+
/// <summary>
13+
/// Receives MSBuild logging events over a pipe. This is the base class for <see cref="AnonymousPipeLoggerServer"/>
14+
/// and <see cref="NamedPipeLoggerServer"/>.
15+
/// </summary>
1216
public class PipeLoggerServer : EventArgsDispatcher, IDisposable
1317
{
1418
// This comes from https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/master/src/StructuredLogger/BinaryLogger/BinaryLogger.cs
@@ -18,6 +22,10 @@ public class PipeLoggerServer : EventArgsDispatcher, IDisposable
1822
private readonly BinaryReader _binaryReader;
1923
private readonly Func<BuildEventArgs> _read;
2024

25+
/// <summary>
26+
/// Creates a server that receives MSBuild events over a specified pipe.
27+
/// </summary>
28+
/// <param name="pipeStream">The pipe to receive events from.</param>
2129
public PipeLoggerServer(PipeStream pipeStream)
2230
{
2331
PipeStream = pipeStream;
@@ -42,6 +50,11 @@ public PipeLoggerServer(PipeStream pipeStream)
4250

4351
protected PipeStream PipeStream { get; }
4452

53+
/// <summary>
54+
/// Reads a single event from the pipe. This method blocks until an event is received,
55+
/// there are no more events, or the pipe is closed.
56+
/// </summary>
57+
/// <returns><c>true</c> if an event was read, <c>false</c> otherwise.</returns>
4558
public virtual bool Read()
4659
{
4760
// Now read one message from the stream
@@ -61,6 +74,7 @@ public virtual bool Read()
6174
return false;
6275
}
6376

77+
/// <inheritdoc/>
6478
public void Dispose()
6579
{
6680
_binaryReader.Dispose();

0 commit comments

Comments
 (0)