Logging - angelobreuer/Lavalink4NET GitHub Wiki
Enabling logging
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]);
Creating a 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.