James Tombleson
c0251e2485
* 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.
23 lines
736 B
C#
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();
|
|
}
|
|
} |