Browse Source

Added logging example

tags/docs-0.9
RogueException 9 years ago
parent
commit
64fc4667fe
4 changed files with 27 additions and 2 deletions
  1. +8
    -1
      docs/features/logging.rst
  2. +0
    -0
      docs/samples/console.cs
  3. +19
    -0
      docs/samples/logging.cs
  4. +0
    -1
      src/Discord.Net/DiscordClient.cs

+ 8
- 1
docs/features/logging.rst View File

@@ -1,4 +1,11 @@
|stub| Logging
==============

|stub-desc|
|stub-desc|

Example
-------

.. literalinclude:: samples/logging.cs
:language: csharp6
:tab-width: 2

+ 0
- 0
docs/samples/console.cs View File


+ 19
- 0
docs/samples/logging.cs 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");
});
}
}

+ 0
- 1
src/Discord.Net/DiscordClient.cs 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;



Loading…
Cancel
Save