Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions 15 src/NEventStore.Example/MainProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace NEventStore.Example
using System;
using NEventStore;
using Logging;
using Microsoft.Extensions.Logging;

internal static class MainProgram
{
Expand All @@ -12,7 +13,7 @@ internal static class MainProgram

private static void Main()
{
Console.WindowWidth = Console.LargestWindowWidth - 20;
//Console.WindowWidth = Console.LargestWindowWidth - 20;

using (store = WireupEventStore())
{
Expand All @@ -28,9 +29,17 @@ private static void Main()

private static IStoreEvents WireupEventStore()
{


var loggerFactory = LoggerFactory.Create(logging => {
logging
.AddConsole()
.AddDebug()
.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
});

return Wireup.Init()
.LogToOutputWindow(LogLevel.Verbose)
.LogToConsoleWindow(LogLevel.Verbose)
.WithLoggerFactory(loggerFactory)
.UseOptimisticPipelineHook()
.UsingInMemoryPersistence()
.InitializeStorageEngine()
Expand Down
10 changes: 8 additions & 2 deletions 10 src/NEventStore.Example/NEventStore.Example.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand All @@ -13,7 +13,7 @@
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">TRACE;DEBUG;NETSTANDARD2_0</DefineConstants>
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">TRACE;DEBUG</DefineConstants>
</PropertyGroup>

Expand All @@ -26,4 +26,10 @@
<ProjectReference Include="..\NEventStore\NEventStore.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Logging.TraceSource" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.8" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
<RootNamespace>NEventStore.Persistence.AcceptanceTests</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
11 changes: 6 additions & 5 deletions 11 src/NEventStore.PollingClient/CommitSequencer.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System;
using Microsoft.Extensions.Logging;
using NEventStore.Helpers;
using NEventStore.Logging;

namespace NEventStore.PollingClient
{
public class CommitSequencer
{
private readonly ILog _logger;
private readonly ILogger _logger;

private readonly Func<ICommit, PollingClient2.HandlingResult> _commitCallback;

Expand Down Expand Up @@ -34,24 +35,24 @@ public PollingClient2.HandlingResult Handle(ICommit commit)
}
else if (_lastCommitRead >= lc)
{
if (_logger.IsWarnEnabled) _logger.Warn(String.Format("Wrong sequence in commit, last read {0} actual read {1}", _lastCommitRead, lc));
_logger.LogWarning(String.Format("Wrong sequence in commit, last read {0} actual read {1}", _lastCommitRead, lc));
return PollingClient2.HandlingResult.MoveToNext;
}

if (outOfSequenceTimestamp == null)
{
if (_logger.IsDebugEnabled) _logger.Debug("Sequencer found out of sequence, last dispatched {0} now dispatching {1}", _lastCommitRead, lc);
_logger.LogDebug("Sequencer found out of sequence, last dispatched {0} now dispatching {1}", _lastCommitRead, lc);
outOfSequenceTimestamp = DateTimeService.Now;
}
else
{
var interval = DateTimeService.Now.Subtract(outOfSequenceTimestamp.Value);
if (interval.TotalMilliseconds > _outOfSequenceTimeoutInMilliseconds)
{
if (_logger.IsDebugEnabled) _logger.Debug("Sequencer out of sequence timeout after {0} ms, last dispatched {1} now dispatching {2}", interval.TotalMilliseconds, _lastCommitRead, lc);
_logger.LogDebug("Sequencer out of sequence timeout after {0} ms, last dispatched {1} now dispatching {2}", interval.TotalMilliseconds, _lastCommitRead, lc);
return InnerHandleResult(commit, lc);
}
if (_logger.IsDebugEnabled) _logger.Debug("Sequencer still out of sequence from {0} ms, last dispatched {1} now dispatching {2}", interval.TotalMilliseconds, _lastCommitRead, lc);
_logger.LogDebug("Sequencer still out of sequence from {0} ms, last dispatched {1} now dispatching {2}", interval.TotalMilliseconds, _lastCommitRead, lc);
}

return PollingClient2.HandlingResult.Retry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>NEventStore.PollingClient</RootNamespace>
<AssemblyName>NEventStore.PollingClient</AssemblyName>
Expand All @@ -19,7 +19,7 @@
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">TRACE;DEBUG;NETSTANDARD2_0</DefineConstants>
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">TRACE;DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand Down
7 changes: 4 additions & 3 deletions 7 src/NEventStore.PollingClient/PollingClient2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using NEventStore.Logging;
using NEventStore.Persistence;
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;

namespace NEventStore.PollingClient
{
Expand All @@ -19,7 +20,7 @@ public enum HandlingResult
Stop = 2,
}

private readonly ILog _logger;
private readonly ILogger _logger;

private readonly Func<ICommit, HandlingResult> _commitCallback;

Expand Down Expand Up @@ -190,7 +191,7 @@ private bool InnerPoll()
var result = _commitCallback(commit);
if (result == HandlingResult.Retry)
{
if (_logger.IsVerboseEnabled) _logger.Verbose("Commit callback ask retry for checkpointToken {0} - last dispatched {1}", commit.CheckpointToken, _checkpointToken);
_logger.LogTrace("Commit callback ask retry for checkpointToken {0} - last dispatched {1}", commit.CheckpointToken, _checkpointToken);
break;
}
else if (result == HandlingResult.Stop)
Expand All @@ -211,7 +212,7 @@ private bool InnerPoll()
// These exceptions are expected to be transient, we log at maximum a log each minute.
if (DateTime.UtcNow.Subtract(_lastPollingErrorLogTimestamp).TotalMinutes > 1)
{
if (_logger.IsErrorEnabled) _logger.Error(String.Format("Error during polling client {0}", ex.ToString()));
_logger.LogError(String.Format("Error during polling client {0}", ex.ToString()));
_lastPollingErrorLogTimestamp = DateTime.UtcNow;
}

Expand Down
4 changes: 2 additions & 2 deletions 4 src/NEventStore.PollingClientExample/MainProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ private static void SaveCheckpoint(Int64 checkpointToken)
private static IStoreEvents WireupEventStore()
{
return Wireup.Init()
.LogToOutputWindow(LogLevel.Verbose)
.LogToConsoleWindow(LogLevel.Verbose)
//.LogToOutputWindow(LogLevel.Verbose)
//.LogToConsoleWindow(LogLevel.Verbose)
.UsingInMemoryPersistence()
.InitializeStorageEngine()
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand Down
16 changes: 7 additions & 9 deletions 16 src/NEventStore.Serialization.Bson/BsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ namespace NEventStore.Serialization.Bson
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Linq;
using Microsoft.Extensions.Logging;

public class BsonSerializer : ISerialize
{
private static readonly ILog Logger = LogFactory.BuildLogger(typeof(BsonSerializer));
private static readonly ILogger Logger = LogFactory.BuildLogger(typeof(BsonSerializer));

private readonly IEnumerable<Type> _knownTypes = new[] { typeof(List<EventMessage>), typeof(Dictionary<string, object>) };

Expand All @@ -39,12 +40,9 @@ public BsonSerializer(params Type[] knownTypes)

_knownTypes = knownTypes ?? _knownTypes;

if (Logger.IsDebugEnabled)
foreach (var type in _knownTypes)
{
foreach (var type in _knownTypes)
{
Logger.Debug(Messages.RegisteringKnownType, type);
}
Logger.LogDebug(Messages.RegisteringKnownType, type);
}
}

Expand Down Expand Up @@ -79,11 +77,11 @@ protected virtual Newtonsoft.Json.JsonSerializer GetSerializer(Type typeToSerial
{
if (_knownTypes.Contains(typeToSerialize))
{
if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.UsingUntypedSerializer, typeToSerialize);
Logger.LogTrace(Messages.UsingUntypedSerializer, typeToSerialize);
return _untypedSerializer;
}

if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.UsingTypedSerializer, typeToSerialize);
Logger.LogTrace(Messages.UsingTypedSerializer, typeToSerialize);
return _typedSerializer;
}

Expand All @@ -95,7 +93,7 @@ private static bool IsArray(Type type)
bool array = typeof(IEnumerable).GetTypeInfo().IsAssignableFrom(type) && !typeof(IDictionary).GetTypeInfo().IsAssignableFrom(type);
#endif

if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.TypeIsArray, type, array);
Logger.LogTrace(Messages.TypeIsArray, type, array);

return array;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>NEventStore.Serialization.Bson</RootNamespace>
<AssemblyName>NEventStore.Serialization.Bson</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand Down
20 changes: 9 additions & 11 deletions 20 src/NEventStore.Serialization.Json/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ namespace NEventStore.Serialization.Json
using System.Text;
using Newtonsoft.Json;
using NEventStore.Logging;
using Microsoft.Extensions.Logging;

public class JsonSerializer : ISerialize
{
private static readonly ILog Logger = LogFactory.BuildLogger(typeof(JsonSerializer));
private static readonly ILogger Logger = LogFactory.BuildLogger(typeof(JsonSerializer));

private readonly IEnumerable<Type> _knownTypes = new[] { typeof(List<EventMessage>), typeof(Dictionary<string, object>) };

Expand All @@ -36,19 +37,16 @@ public JsonSerializer(params Type[] knownTypes)
}

_knownTypes = knownTypes ?? _knownTypes;

if (Logger.IsDebugEnabled)
foreach (var type in _knownTypes)
{
foreach (var type in _knownTypes)
{
Logger.Debug(Messages.RegisteringKnownType, type);
}
Logger.LogDebug(Messages.RegisteringKnownType, type);
}
}

public virtual void Serialize<T>(Stream output, T graph)
{
if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.SerializingGraph, typeof(T));
Logger.LogTrace(Messages.SerializingGraph, typeof(T));
using (var streamWriter = new StreamWriter(output, Encoding.UTF8))
using (var jsonTextWriter = new JsonTextWriter(streamWriter))
{
Expand All @@ -58,7 +56,7 @@ public virtual void Serialize<T>(Stream output, T graph)

public virtual T Deserialize<T>(Stream input)
{
if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.DeserializingStream, typeof(T));
Logger.LogTrace(Messages.DeserializingStream, typeof(T));
using (var streamReader = new StreamReader(input, Encoding.UTF8))
using (var jsonTextReader = new JsonTextReader(streamReader))
{
Expand All @@ -81,11 +79,11 @@ protected virtual Newtonsoft.Json.JsonSerializer GetSerializer(Type typeToSerial
{
if (_knownTypes.Contains(typeToSerialize))
{
if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.UsingUntypedSerializer, typeToSerialize);
Logger.LogTrace(Messages.UsingUntypedSerializer, typeToSerialize);
return _untypedSerializer;
}

if (Logger.IsVerboseEnabled) Logger.Verbose(Messages.UsingTypedSerializer, typeToSerialize);
Logger.LogTrace(Messages.UsingTypedSerializer, typeToSerialize);
return _typedSerializer;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>NEventStore.Serialization.Json</RootNamespace>
<AssemblyName>NEventStore.Serialization.Json</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
Expand Down
4 changes: 2 additions & 2 deletions 4 src/NEventStore.Tests/NEventStore.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsPackable>false</IsPackable>
<AssemblyName>NEventStore.Tests</AssemblyName>
Expand All @@ -12,7 +12,7 @@
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">TRACE;DEBUG;NUNIT;NETSTANDARD2_0</DefineConstants>
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">NUNIT;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">TRACE;DEBUG;NUNIT</DefineConstants>
<DefineConstants Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">NUNIT</DefineConstants>
</PropertyGroup>
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.