|
|
@@ -14,12 +14,14 @@ section. |
|
|
|
### Usage |
|
|
|
|
|
|
|
To receive log events, simply hook the discord client's log method |
|
|
|
to a Task with a single parameter of type [LogMessage] |
|
|
|
to a `Task` with a single parameter of type [LogMessage]. |
|
|
|
|
|
|
|
It is recommended that you use an established function instead of a |
|
|
|
lambda for handling logs, because most [addons] accept a reference |
|
|
|
lambda for handling logs, because most addons accept a reference |
|
|
|
to a logging function to write their own messages. |
|
|
|
|
|
|
|
[LogMessage]: xref:Discord.LogMessage |
|
|
|
|
|
|
|
### Usage in Commands |
|
|
|
|
|
|
|
Discord.Net's [CommandService] also provides a log event, identical |
|
|
@@ -29,6 +31,9 @@ Data logged through this event is typically coupled with a |
|
|
|
[CommandException], where information about the command's context |
|
|
|
and error can be found and handled. |
|
|
|
|
|
|
|
[CommandService]: Discord.Commands.CommandService |
|
|
|
[CommandException]: Discord.Commands.CommandException |
|
|
|
|
|
|
|
#### Samples |
|
|
|
|
|
|
|
[!code-csharp[Logging Sample](samples/logging.cs)] |
|
|
|