using Serilog; namespace Newsbot.Collector.Services.Jobs; public static class JobLogger { public static ILogger GetLogger(string connectionString, string jobName) { if (connectionString == "") return Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger(); return Log.Logger = new LoggerConfiguration() .WriteTo.Console() .MinimumLevel.Debug() .WriteTo.OpenTelemetry( connectionString, resourceAttributes: new Dictionary { { "service.name", "newsbot-collector-api" }, { "Job", jobName } }) .CreateLogger(); } }