Add missing format providers (fix CA1305 errors) (#8745)

This commit is contained in:
Terrance 2022-11-27 01:59:25 +00:00 committed by GitHub
parent 89772032e8
commit 692a62ab4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -178,7 +178,7 @@ namespace Jellyfin.Api.Controllers
foreach (var key in displayPreferences.CustomPrefs.Keys.Where(key => key.StartsWith("homesection", StringComparison.OrdinalIgnoreCase))) foreach (var key in displayPreferences.CustomPrefs.Keys.Where(key => key.StartsWith("homesection", StringComparison.OrdinalIgnoreCase)))
{ {
var order = int.Parse(key.AsSpan().Slice("homesection".Length)); var order = int.Parse(key.AsSpan().Slice("homesection".Length), NumberStyles.Any, CultureInfo.InvariantCulture);
if (!Enum.TryParse<HomeSectionType>(displayPreferences.CustomPrefs[key], true, out var type)) if (!Enum.TryParse<HomeSectionType>(displayPreferences.CustomPrefs[key], true, out var type))
{ {
type = order < 8 ? defaults[order] : HomeSectionType.None; type = order < 8 ? defaults[order] : HomeSectionType.None;

View File

@ -351,7 +351,7 @@ namespace Jellyfin.Api.Helpers
try try
{ {
// Parses npt times in the format of '10:19:25.7' // Parses npt times in the format of '10:19:25.7'
return TimeSpan.Parse(value).Ticks; return TimeSpan.Parse(value, CultureInfo.InvariantCulture).Ticks;
} }
catch catch
{ {

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -612,11 +613,14 @@ namespace Jellyfin.Server
catch (Exception ex) catch (Exception ex)
{ {
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}") .WriteTo.Console(
outputTemplate: "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}",
formatProvider: CultureInfo.InvariantCulture)
.WriteTo.Async(x => x.File( .WriteTo.Async(x => x.File(
Path.Combine(appPaths.LogDirectoryPath, "log_.log"), Path.Combine(appPaths.LogDirectoryPath, "log_.log"),
rollingInterval: RollingInterval.Day, rollingInterval: RollingInterval.Day,
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}", outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}",
formatProvider: CultureInfo.InvariantCulture,
encoding: Encoding.UTF8)) encoding: Encoding.UTF8))
.Enrich.FromLogContext() .Enrich.FromLogContext()
.Enrich.WithThreadId() .Enrich.WithThreadId()