Team XSockets.NET

Default Logging

As mentioned in the logging introduction XSockets use Serilog as the default logger.

Serilog offers (as most logging frameworks) several different levels of logging.

  • Verbose
  • Debug
  • Information
  • Warning
  • Error
  • Fatal

The XSockets implementation has the level set to Information by default. This means that the logger will log Information, Warning, Error and Fatal.

Serilog offers sinks so that you can log to several places at once.

Default Configuration

When you install XSockets you get a default configuration that looks like this.

using System.IO;
using Serilog;
using XSockets.Logger;

// For details about configuration, visit
public class MyLogger : XLogger
    public MyLogger()
        Log.Logger = new LoggerConfiguration().MinimumLevel.Information()
        //.WriteTo.RollingFile(Path.Combine(Directory.GetCurrentDirectory(), "Log\\Log-{Date}.txt"))

As you can see the logger will write logs for level information or higher, and the logs will be written to ColoredConsole and Trace. The RollingFile is commented out by default. For more information about available sinks see Serilog.

If you need to add the configuration manually you can find a template under XSockets.NET 5

logger template

results matching ""

    No results matching ""