Newsbot.Collector/Newsbot.Collector.Services/Jobs/JobLogger.cs
James Tombleson c0251e2485
Features/discord errors (#22)
* catching another http error code.

* more discord logging

* Setting min logging to debug for now.

* program logging is set to info but job logging is debug.
2023-04-03 09:31:00 -07:00

23 lines
736 B
C#

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<string, object>
{
{ "service.name", "newsbot-collector-api" },
{ "Job", jobName }
})
.CreateLogger();
}
}