Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Commit

Permalink
Added missing Tracer files
Browse files Browse the repository at this point in the history
Also made the package automatically initialize its own manager to the SystemDiagnostics one so that TraceSources can be configured from any consuming libraryo
  • Loading branch information
kzu committed Dec 10, 2014
1 parent aa90c03 commit a7289f8
Show file tree
Hide file tree
Showing 15 changed files with 1,364 additions and 4 deletions.
12 changes: 11 additions & 1 deletion .nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
</Target>

<Target Name="_DownloadNuGet">
<Message Importance="high" Text="MSBuildToolsVersion: $(MSBuildToolsVersion), MSBuildToolsPath: $(MSBuildToolsPath)" />

<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

Expand All @@ -99,7 +101,15 @@
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<PropertyGroup>
<CodeTaskAssembly Condition="'$(MSBuildAssemblyVersion)' == ''">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll</CodeTaskAssembly>
<!-- In VS2013, the assembly contains the VS version. -->
<CodeTaskAssembly Condition="'$(CodeTaskAssembly)' != '' and '$(MSBuildAssemblyVersion)' == '12.0'">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll</CodeTaskAssembly>
<!-- In VS2015+, the assembly was renamed, hopefully this will be the last condition! -->
<CodeTaskAssembly Condition="'$(MSBuildAssemblyVersion)' != '' and '$(MSBuildAssemblyVersion)' &gt;= '14.0'">$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll</CodeTaskAssembly>
</PropertyGroup>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(CodeTaskAssembly)">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
Expand Down
1 change: 0 additions & 1 deletion ReactiveSockets.Tests/ReactiveSockets.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
<Compile Include="TcpClientSocketTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion ReactiveSockets.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>ReactiveSockets</id>
<version>0.2.5</version>
<version>0.2.6</version>
<title>Reactive Sockets</title>
<summary>The easiest way to do socket programming in .NET, leveraging simple Rx queries to implement your protocols.</summary>
<description>
Expand Down
64 changes: 64 additions & 0 deletions ReactiveSockets/External/Diagnostics/Tracer/ITracer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#region BSD License
/*
Copyright (c) 2011, Clarius Consulting
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Clarius Consulting nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
*/
#endregion

namespace ReactiveSockets.Diagnostics
{
using System;
using System.Diagnostics;

/// <summary>
/// Interface used by the application components to log messages.
/// </summary>
/// <nuget id="Tracer.Interfaces" />
partial interface ITracer
{
/// <summary>
/// Traces the specified message with the given <see cref="TraceEventType"/>.
/// </summary>
void Trace(TraceEventType type, object message);

/// <summary>
/// Traces the specified formatted message with the given <see cref="TraceEventType"/>.
/// </summary>
void Trace(TraceEventType type, string format, params object[] args);

/// <summary>
/// Traces an exception with the specified message and <see cref="TraceEventType"/>.
/// </summary>
void Trace(TraceEventType type, Exception exception, object message);

/// <summary>
/// Traces an exception with the specified formatted message and <see cref="TraceEventType"/>.
/// </summary>
void Trace(TraceEventType type, Exception exception, string format, params object[] args);
}
}
224 changes: 224 additions & 0 deletions ReactiveSockets/External/Diagnostics/Tracer/ITracerExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
#region BSD License
/*
Copyright (c) 2011, Clarius Consulting
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Clarius Consulting nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
*/
#endregion

namespace ReactiveSockets.Diagnostics
{
using System;
using System.Diagnostics;

/// <summary>
/// Provides usability overloads for tracing to a <see cref="ITracer"/>.
/// </summary>
/// <nuget id="Tracer.Interfaces" />
static partial class ITracerExtensions
{
#region Critical overloads

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Critical"/> with the given message;
/// </summary>
public static void Critical(this ITracer tracer, object message)
{
tracer.Trace(TraceEventType.Critical, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Critical"/> with the given format string and arguments.
/// </summary>
public static void Critical(this ITracer tracer, string format, params object[] args)
{
tracer.Trace(TraceEventType.Critical, format, args);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Critical"/> with the given exception and message.
/// </summary>
public static void Critical(this ITracer tracer, Exception exception, object message)
{
tracer.Trace(TraceEventType.Critical, exception, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Critical"/> with the given exception, format string and arguments.
/// </summary>
public static void Critical(this ITracer tracer, Exception exception, string format, params object[] args)
{
tracer.Trace(TraceEventType.Critical, exception, format, args);
}

#endregion

#region Error overloads

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Error"/> with the given message;
/// </summary>
public static void Error(this ITracer tracer, object message)
{
tracer.Trace(TraceEventType.Error, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Error"/> with the given format string and arguments.
/// </summary>
public static void Error(this ITracer tracer, string format, params object[] args)
{
tracer.Trace(TraceEventType.Error, format, args);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Error"/> with the given exception and message.
/// </summary>
public static void Error(this ITracer tracer, Exception exception, object message)
{
tracer.Trace(TraceEventType.Error, exception, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Error"/> with the given exception, format string and arguments.
/// </summary>
public static void Error(this ITracer tracer, Exception exception, string format, params object[] args)
{
tracer.Trace(TraceEventType.Error, exception, format, args);
}

#endregion

#region Warn overloads

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Warning"/> with the given message;
/// </summary>
public static void Warn(this ITracer tracer, object message)
{
tracer.Trace(TraceEventType.Warning, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Warning"/> with the given format string and arguments.
/// </summary>
public static void Warn(this ITracer tracer, string format, params object[] args)
{
tracer.Trace(TraceEventType.Warning, format, args);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Warning"/> with the given exception and message.
/// </summary>
public static void Warn(this ITracer tracer, Exception exception, object message)
{
tracer.Trace(TraceEventType.Warning, exception, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Warning"/> with the given exception, format string and arguments.
/// </summary>
public static void Warn(this ITracer tracer, Exception exception, string format, params object[] args)
{
tracer.Trace(TraceEventType.Warning, exception, format, args);
}

#endregion

#region Info overloads

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Information"/> with the given message;
/// </summary>
public static void Info(this ITracer tracer, object message)
{
tracer.Trace(TraceEventType.Information, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Information"/> with the given format string and arguments.
/// </summary>
public static void Info(this ITracer tracer, string format, params object[] args)
{
tracer.Trace(TraceEventType.Information, format, args);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Information"/> with the given exception and message.
/// </summary>
public static void Info(this ITracer tracer, Exception exception, object message)
{
tracer.Trace(TraceEventType.Information, exception, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Information"/> with the given exception, format string and arguments.
/// </summary>
public static void Info(this ITracer tracer, Exception exception, string format, params object[] args)
{
tracer.Trace(TraceEventType.Information, exception, format, args);
}

#endregion

#region Verbose overloads

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Verbose"/> with the given message;
/// </summary>
public static void Verbose(this ITracer tracer, object message)
{
tracer.Trace(TraceEventType.Verbose, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Verbose"/> with the given format string and arguments.
/// </summary>
public static void Verbose(this ITracer tracer, string format, params object[] args)
{
tracer.Trace(TraceEventType.Verbose, format, args);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Verbose"/> with the given exception and message.
/// </summary>
public static void Verbose(this ITracer tracer, Exception exception, object message)
{
tracer.Trace(TraceEventType.Verbose, exception, message);
}

/// <summary>
/// Traces an event of type <see cref="TraceEventType.Verbose"/> with the given exception, format string and arguments.
/// </summary>
public static void Verbose(this ITracer tracer, Exception exception, string format, params object[] args)
{
tracer.Trace(TraceEventType.Verbose, exception, format, args);
}

#endregion
}
}
47 changes: 47 additions & 0 deletions ReactiveSockets/External/Diagnostics/Tracer/ITracerManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#region BSD License
/*
Copyright (c) 2011, Clarius Consulting
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Clarius Consulting nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
*/
#endregion

namespace ReactiveSockets.Diagnostics
{
/// <summary>
/// Manages <see cref="ITracer"/> instances. Provides the implementation
/// for the <see cref="Tracer"/> static facade class.
/// </summary>
/// <nuget id="Tracer.Interfaces" />
partial interface ITracerManager
{
/// <summary>
/// Gets a tracer instance with the specified name.
/// </summary>
ITracer Get(string name);
}
}
Loading

0 comments on commit a7289f8

Please sign in to comment.