Adding debug logs

This commit is contained in:
Zoe Roux 2020-03-10 01:15:43 +01:00
parent ec383ffeac
commit c5b6b62925
4 changed files with 23 additions and 2 deletions

View File

@ -18,6 +18,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" /> <ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
<PackageReference Include="IdentityServer4" Version="3.1.2" /> <PackageReference Include="IdentityServer4" Version="3.1.2" />

View File

@ -23,11 +23,14 @@ namespace Kyoo
{ {
ClientId = "kyoo.webapp", ClientId = "kyoo.webapp",
AllowedGrantTypes = GrantTypes.Code, AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
AllowAccessTokensViaBrowser = true,
AllowOfflineAccess = true, AllowOfflineAccess = true,
RequireClientSecret = false, RequireClientSecret = false,
RequireConsent = false, RequireConsent = false,
AccessTokenType = AccessTokenType.Reference,
AllowedScopes = { "kyoo.admin", "kyoo.write", "kyoo.read", "openid", "profile" }, AllowedScopes = { "kyoo.admin", "kyoo.write", "kyoo.read", "openid", "profile" },
RedirectUris = { "/logged", "/silent" }, RedirectUris = { "/silent", "/" },
PostLogoutRedirectUris = { "/logout" } PostLogoutRedirectUris = { "/logout" }
} }
}; };

View File

@ -4,6 +4,9 @@ using Kyoo.Controllers;
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
namespace Kyoo namespace Kyoo
{ {
@ -11,12 +14,25 @@ namespace Kyoo
{ {
public static async Task Main(string[] args) public static async Task Main(string[] args)
{ {
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Console(
outputTemplate:
"[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}",
theme: AnsiConsoleTheme.Literate)
.CreateLogger();
Console.WriteLine($"Running as: {Environment.UserName}"); Console.WriteLine($"Running as: {Environment.UserName}");
await CreateWebHostBuilder(args).Build().RunAsync(); await CreateWebHostBuilder(args).Build().RunAsync();
} }
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseSerilog()
.UseKestrel((config) => { config.AddServerHeader = false; }) .UseKestrel((config) => { config.AddServerHeader = false; })
.UseUrls("http://*:5000") .UseUrls("http://*:5000")
.UseStartup<Startup>(); .UseStartup<Startup>();

@ -1 +1 @@
Subproject commit a0c75642302151caf6fc0c616305f569cc6557e5 Subproject commit afdddfd7b12d9e31367cec4ad20c3ea2ac169f0c