-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
39 lines (36 loc) · 1.45 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Serilog;
namespace SchedulingAssistant
{
internal class Program
{
public static void Main(string[] args = null)
{
while (true)
{
#if DEBUG
Log.Logger = new LoggerConfiguration()
.WriteTo.File("Logs/duinbot.log", rollingInterval: RollingInterval.Day)
.WriteTo.Console(outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{SourceContext}] [{Level}] {Message}{NewLine}{Exception}")
.MinimumLevel.Debug()
.CreateLogger();
#else
Log.Logger = new LoggerConfiguration()
.WriteTo.File("Logs/duinbot.log", rollingInterval: RollingInterval.Day)
.WriteTo.Console(outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{SourceContext}] [{Level}] {Message}{NewLine}{Exception}")
.MinimumLevel.Information()
.CreateLogger();
#endif
try
{
var KEY = Environment.GetEnvironmentVariable("DISCORD_BOT_TOKEN") ?? "";
new Bot().StartAsync(KEY).GetAwaiter().GetResult();
}
catch (Exception ex)
{
Log.Logger.Error(ex.Message);
}
Task.Delay(5000);
}
}
}
}