Added logging example

This commit is contained in:
RogueException
2015-10-02 21:56:07 -03:00
parent a4f6f0ac32
commit 64fc4667fe
4 changed files with 27 additions and 2 deletions

View File

@@ -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
View 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");
});
}
}

View File

@@ -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;