-
-
Notifications
You must be signed in to change notification settings - Fork 29
Logging
MrCakeSlayer edited this page Sep 24, 2022
·
1 revision
Lavalink4NET provides additional logging:
To enable it specify a logger implementation in the constructor:
var audioService = new LavalinkNode(new LavalinkNodeOptions{[...]},
new DiscordClientWrapper(client),
[Your Logger Implementation]);
Example implementation
public class MyLogger
{
public void Log(object source, string message, LogLevel level = LogLevel.Information, Exception exception = null)
{
Console.WriteLine($"{level} {message} (from {source.GetType().FullName})");
if (exception != null)
{
Console.WriteLine(exception);
}
}
}
For an example implementation you can see: CustomLogger.cs. The example is a wrapper for Microsoft.Extensions.Logging(.Abstraction) to a Lavalink4NET logger.
If you want to create your own logger implementation, you need to implement the ILogger interface.
Lavalink4NET Wiki - Licensed under MIT