Skip to content

Commit

Permalink
Merge pull request #51 from nblumhardt/dev
Browse files Browse the repository at this point in the history
3.0.1 Release
  • Loading branch information
nblumhardt authored Jul 15, 2022
2 parents d3f69b4 + 4cbddad commit f28e5f7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/SerilogTimings/CompletionBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ enum CompletionBehaviour
Complete,
Silent
}
}
}
1 change: 0 additions & 1 deletion src/SerilogTimings/Extensions/LoggerOperationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using Serilog;
using Serilog.Events;
using SerilogTimings.Configuration;
Expand Down
8 changes: 4 additions & 4 deletions src/SerilogTimings/Operation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ public enum Properties
};

const string OutcomeCompleted = "completed", OutcomeAbandoned = "abandoned";
static readonly long StopwatchToTimeSpanTicks = Stopwatch.Frequency / TimeSpan.TicksPerSecond;
static readonly double StopwatchToTimeSpanTicks = (double)Stopwatch.Frequency / TimeSpan.TicksPerSecond;

ILogger _target;
readonly string _messageTemplate;
readonly object[] _args;
readonly long _start;
long? _stop;

IDisposable _popContext;
readonly IDisposable _popContext;
CompletionBehaviour _completionBehaviour;
readonly LogEventLevel _completionLevel;
readonly LogEventLevel _abandonmentLevel;
private readonly TimeSpan? _warningThreshold;
readonly TimeSpan? _warningThreshold;
Exception? _exception;

internal Operation(ILogger target, string messageTemplate, object[] args,
Expand All @@ -87,7 +87,7 @@ internal Operation(ILogger target, string messageTemplate, object[] args,

static long GetTimestamp()
{
return Stopwatch.GetTimestamp() / StopwatchToTimeSpanTicks;
return unchecked((long)(Stopwatch.GetTimestamp() / StopwatchToTimeSpanTicks));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/SerilogTimings/SerilogTimings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Extend Serilog with timed operations.</Description>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionPrefix>3.0.1</VersionPrefix>
<Authors>nblumhardt;SerilogTimings Contributors</Authors>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
2 changes: 1 addition & 1 deletion test/SerilogTimings.Tests/OperationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public async Task TimingWithinOrderOfMagnitude(int delay)
op.Dispose();

var elapsed = GetElapsedMilliseconds(logger);
Assert.InRange(elapsed, delay * 0.5, delay * 5);
Assert.InRange(elapsed, delay * 0.2, delay * 8);
}

[Fact]
Expand Down

0 comments on commit f28e5f7

Please sign in to comment.