Added logging example
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
|stub| Logging
|
||||
==============
|
||||
|
||||
|stub-desc|
|
||||
|stub-desc|
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
.. literalinclude:: samples/logging.cs
|
||||
:language: csharp6
|
||||
:tab-width: 2
|
||||
19
docs/samples/logging.cs
Normal file
19
docs/samples/logging.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
class Program
|
||||
{
|
||||
private static DiscordBotClient _client;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var client = new DiscordClient(new DiscordClientConfig {
|
||||
//Warning: Debug mode should only be used for identifying problems. It _will_ slow your application down.
|
||||
LogLevel = LogMessageSeverity.Debug
|
||||
});
|
||||
client.LogMessage += (s, e) => Console.WriteLine($"[{e.Severity}] {e.Source}: {e.Message}");
|
||||
|
||||
client.Run(async () =>
|
||||
{
|
||||
await client.Connect("discordtest@email.com", "Password123");
|
||||
if (!client.Servers.Any())
|
||||
await client.AcceptInvite("aaabbbcccdddeee");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using VoiceWebSocket = Discord.WebSockets.Voice.VoiceWebSocket;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user