95220e2ed6
The startup configuration only reads JELLYFIN_ prefixed environment variables, so the bare Jellyfin__TranscodeStore__* form used by the chart, the manifests and the README is dropped and the Redis store is never registered. Nothing logs the selected store, so the fallback is invisible. - Read bare Jellyfin__* variables into the Jellyfin:* configuration root - Keep an explicit JELLYFIN_ variable winning over the bare form - Log the selected transcode session store at startup - Ping Redis once at startup and log an unreachable store at Error - Log endpoints only, never the connection string
43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Jellyfin.Server.Tests.HighAvailability;
|
|
|
|
/// <summary>
|
|
/// An <see cref="ILogger"/> that keeps every formatted entry so tests can assert on the startup
|
|
/// signals operators rely on.
|
|
/// </summary>
|
|
/// <typeparam name="T">The category type.</typeparam>
|
|
internal sealed class RecordingLogger<T> : ILogger<T>
|
|
{
|
|
private readonly List<(LogLevel Level, string Message, Exception? Exception)> _entries = new();
|
|
|
|
public IReadOnlyList<(LogLevel Level, string Message, Exception? Exception)> Entries => _entries;
|
|
|
|
public IDisposable BeginScope<TState>(TState state)
|
|
where TState : notnull
|
|
=> NoopScope.Instance;
|
|
|
|
public bool IsEnabled(LogLevel logLevel) => true;
|
|
|
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(formatter);
|
|
_entries.Add((logLevel, formatter(state, exception), exception));
|
|
}
|
|
|
|
public bool HasEntry(LogLevel level, string substring)
|
|
=> _entries.Any(entry => entry.Level == level && entry.Message.Contains(substring, StringComparison.Ordinal));
|
|
|
|
private sealed class NoopScope : IDisposable
|
|
{
|
|
public static readonly NoopScope Instance = new();
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
}
|
|
}
|