Skip to content
Open
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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Matrix.Example.Client uses spaces
# Matrix.Tests omitted as I don't know how to specify multiple targets here
[Matrix/*.cs]
curly_bracket_next_line = true
indent_style = tab
indent_size = 4
4 changes: 4 additions & 0 deletions Matrix.Tests/Backend/TestingAPIBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public MatrixRequestError Get (string apiPath, bool authenticate, out JToken re
return null;
}

public Task<MatrixAPIResult> GetAsync(string apiPath, bool authenticate) {
return null;
}

public MatrixRequestError Post (string apiPath, bool authenticate, JToken request, out JToken result) {
result = null;
return null;
Expand Down
2 changes: 1 addition & 1 deletion Matrix/Client/Keys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public Keys(MatrixAPI api)

}
}
}
}
1 change: 1 addition & 0 deletions Matrix/Client/MatrixClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public MatrixClient (string URL, string application_token, string userid)
/// Initializes a new instance of the <see cref="Matrix.Client.MatrixClient"/> class for testing.
/// </summary>
public MatrixClient (MatrixAPI api){
log.LogDebug("ctor: baseurl={}", api.BaseURL);
this.Api = api;
api.SyncJoinEvent += MatrixClient_OnEvent;
api.SyncInviteEvent += MatrixClient_OnInvite;
Expand Down
28 changes: 24 additions & 4 deletions Matrix/Logger.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Options;

namespace Matrix
{
public static class Logger
{
public static ILoggerFactory Factory = LoggerFactory.Create(builder =>
{

});
static ILoggerFactory factory;

/// <summary>
/// Needs to be externally set, one typical use case would be it's set during Startup configuration
/// </summary>
public static ILoggerFactory Factory {
get
{
// Stuffing in a console logger in a 2.1+ compatible way looks
// like a lot of work if you aren't using IServiceCollection
#if NETSTANDARD2_0
if (factory == null)
// Call may not be present in .NET Standard 2.1
factory = new LoggerFactory().AddConsole(LogLevel.Debug);
#endif
// NOTE: Might not be performant always creating empty factories,
// but want to give code opportunity to eventually log somehow
// (i.e. you really are expected to assign Factory)
return factory ?? new LoggerFactory();
}
set { factory = value; }
}
}
}
6 changes: 1 addition & 5 deletions Matrix/Matrix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
<PackageReleaseNotes>Initial package release.</PackageReleaseNotes>
<Copyright>Copyright 2017</Copyright>
<PackageTags>Matrix SDK</PackageTags>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0-preview.19074.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="YamlDotNet" Version="5.3.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="bin\**;obj\**;" />
</ItemGroup>
</Project>